Thursday, January 6, 2022

[FIXED] How do I instruct artisan to save model to specific directory?

Issue

I'm using Laravel 5. I have created a /Models directory under the /App directory, but when generating the models using Artisan it's storing them under the App directory.

I have searched the documentation to try and find how to specify a different path name, but to no avail:

php artisan make:model TestModel

How do I instruct artisan to save the model to specific directory?


Solution

If you want to specify the path when generating a model, you can use the Laravel Generators Package. You can then specify the location using the --path option like so:

php artisan generate:model TestModel --path=my/custom/location


Answered By - Bogdan

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.