You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I run php artisan make:model Model but want the model to be in a different folder, I have the following scenarios:
Scenario
Command
Sub folder
php artisan make:model Subfolder/Model
Parent folder
php artisan make:model /App/OtherModels/Model
They both create the controller in the default controller directory instead of using a similar path to the model. That's what I would expect. Creating a model at App\Models\Subfolder\Models and a controller App\Http\Controllers\Subfolder would make more sense to me.
Hint: I observed that model and controller generation handles paths differently. While models resolve the path like above (not perfect but described workaround works), controllers strip all slashes. Why does this behavior differ?
Bonus: It would be more intuitive to specify the path with slashes instead of backslashes because that would look more like the namespace the model will have.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey folks,
when I run
php artisan make:model Model
but want the model to be in a different folder, I have the following scenarios:php artisan make:model Subfolder/Model
php artisan make:model /App/OtherModels/Model
They both create the controller in the default controller directory instead of using a similar path to the model. That's what I would expect. Creating a model at
App\Models\Subfolder\Models
and a controllerApp\Http\Controllers\Subfolder
would make more sense to me.Hint: I observed that model and controller generation handles paths differently. While models resolve the path like above (not perfect but described workaround works), controllers strip all slashes. Why does this behavior differ?
Bonus: It would be more intuitive to specify the path with slashes instead of backslashes because that would look more like the namespace the model will have.
Beta Was this translation helpful? Give feedback.
All reactions