laravel - Adding Model directories to the ClassLoader -
i using october, cms built on top of laravel framework.
in october, pretty plugin based, , models seem defined exclusively within plugin/model
directories. unfortunately, need define , use number of site-wide models
. end, have created classic laravel
app/models
directory , placed them in there.
the framework, however, not detect these models , auto-load them. have had success including them in standard php
files, extent. however, when attempt define relationships between models run problems. think (this wrong) need use whatever autoload system laravel
/october
.
i found illuminate\support\classloader
, tried using adddirectories()
method, passing in ['app/models']
in hopes models undergo "standard" autoload process. unfortunately, while didn't break anything, didn't fix either.
the question:
how can specify custom directory laravel application load upon startup? additional steps need register models
have in aforementioned directory?
you can add classmap
in composer.json
file:
"autoload": { "classmap": [ "app/models" ] }
the way set in regular laravel install.
Comments
Post a Comment