Saravanan Sampathkumar Saravanan Sampathkumar - 3 months ago 27
PHP Question

Generate Model, Controller outside of app folder in Laravel

How to create controller and model files outside of app folder. For example, when we do

php artisan make:model ModelName


it creates Model file inside app folder. When we specify namespace like

php artisan make:model SomeFolder/ModelName


it creates Model file inside app/SomeFolder/ModelName.

I wanted to create model files outside of app folder. How to achieve this?

Answer

I don't see the reason, but I managed to make it on my local computer by php artisan make:model ../../mOdel . Probably in production environment you won't be allowed to do this.

Comments