Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create model in a custom path in laravel

Tags:

I want to create a model in a custom path. If i write the php artisan command like the following it will create model inside app.

php artisan make:model core

But i want to create the model file inside the custom made Models folder. How can i do it ?

like image 262
Saleh Ahmad Oyon Avatar asked May 16 '16 10:05

Saleh Ahmad Oyon


People also ask

How do you make a model inside a folder in laravel?

In the latest version of Laravel, running the command php artisan make:model MyModel will create the model inside the App\Models directory.

How we can create model in laravel?

You can use the artisan make:model command line helper to generate new models for your application. To create a new Eloquent model for your links table, run: docker-compose exec app php artisan make:model Link.

How do I create a model and controller in laravel at one command?

Navigate to your project folder and run the following commands to create new: Model: php artisan make:model YourModelName. Controller: php artisan make:controller YourControllerName. Migration: php artisan make:migration create_users_table.


1 Answers

Just define the path where you want to create model.

php artisan make:model <directory_name>/<model_name>

e.g.

php artisan make:model Models/core
like image 192
sz ashik Avatar answered Sep 21 '22 21:09

sz ashik