laravellaravel-5laravel-artisan

How to create a controller in a sub-folder when defining as a parameter?


I'm creating a project with Laravel and I'm aware that there is a way to create the migration and controller (with or without resources) along with the model with php artisan make:model ExampleModel -m -c -r.

In my project I have models and controllers in sub-folders. I'm able to add the model and controllers to sub-folders when creating them separately (php artisan make:model Models/example_model and same in controllers). But I don't know how to add the controllers to a sub-folder when creating them with a parameter on the make:model command.

I've tried the below commands already and they don't appear to be working

php artisan make:model Models/example -m -MyControllers/c -r

php artisan make:model Models/example -m MyControllers/-c -r


Solution

  • I'm not sure it's possible with the make:model command. My best guess is to use 2 commands:

    php artisan make:model Models/NewModel -m

    php artisan make:controller MyControllers/NewModelController -r