PASSWORD RESET

Your destination for complete Tech news

PHP

How to create a model, controller and migration from a single command in Laravel?

493 0
< 1 min read

You can create a model, controller and migration from a single command in Laravel by using the following command.

php artisan make:model Todo -mcr
Here,
-m, --migration Create a new migration file for the model.
-c, --controller Create a new controller for the model.
-r, --resource Indicates if the generated controller should be a resource controller

In Laravel 5.6 and newer, you can use the following command,

php artisan make:model Todo -a
-a, --all Generate a migration, factory, and resource controller for the model

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.