laravel run migration from controller code example

Example 1: laravel make model with migration and controller

php artisan make:model Todo -mcr

Example 2: create migration, controller, model and seeder laravel

php artisan make:model MODEL_PATH\MODEL_NAME -mcrs
or
php artisan make:model MODEL_PATH\MODEL_NAME -a
  
-a, --all Generate a migration, factory, and resource controller for the model 
-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
-s, --seeder Create a new seeder file for the model.

Example 3: create migration table in php

php artisan make:migration create_users_table

Example 4: laravel create model controller and migration on line

php artisan make:model Todo -a

Tags:

Php Example