Hello Artisan,
In this tutorial, I will show you how to create model in laravel 9. We can create a model in Laravel with a command line or we can create it manually. It is very easy to create a model in Laravel application using the command line. Just run the below command to create a model.
php artisan make:model ModelName
//suppose
php artisan make:model Product
You can create a model with database migration also. Just run the below command:
php artisan make:model Product -m
If you run this command, You will see a Product
model in your model's directory and -m
will create a table for your product migration also. You can also create factory, resource controller, and model with migration with one command. Just run the below command:'
php artisan make:model Product -mrf
//m for migration
//r for resource controller
//f for factory
Read also: Creating File Manager in Laravel Step By Step Guide
Hope it can help you.
#laravel #laravel-9x