This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I have a separate database and would like to form model classes for them.
After reading the documentation, I have created "/plugins/name/product/models/sample.php", and this model work.
For other models I have added in the same folder, they are not loaded. I'm not sure whether they are being ignored or not included in autoload map, but I cannot find models that is not class "sample" from "get_declared_classes()" in octobercms.
On the other hand, it works when i put all the classes into sample.php, but i want to separate them so i can track their changes in git.
And, if possible, how can i change the namespace? now in octobercms i use "use name\product\models;" and then inlinely "models\sample::find(1)" and this keyword models is too easy to collide with other models i'm using. For example, how could it be possible for me to use "use name\product\database1;" and then "database1\sample::find(1)"? The databases are totally in different structure but shared with some other applications.
Hi,
Did you manage to sort the issue out?
I can't seem to make "php artisan make:model TestModelName" work.
My workaround was handcrafting all the classes into the .php file which october can recognize, and didn't use artisan here.
Artisan commands which might have to work with the application namespace seem to not work with October. Hence commands like app:name, make:*, etc. don't work. I am not sure of the reasons why.
However, this is exactly why October provides its own scaffolding commands under the 'create' namespace - For example - "php artisan create:model" works.
Just run "php artisan" to see the commands listed under the "create" namespace and you should be good to go. Say goodbye to manual file creation. Well at least most of the times:-)
1-4 of 4