Creating a new migration file with the correct filename every time you need to change your schema would be a chore. Thankfully, Laravel's artisan
command can generate the migration for you:
php artisan make:migration add_last_logged_in_to_users_table
You can also use the --table
and --create
flags with the above command. These are optional and just for convenience, and will insert the relevant boilerplate code into the migration file.
php artisan make:migration add_last_logged_in_to_users_table --table=users
php artisan make:migration create_logs_table --create=logs
You can specify a custom output path for the generated migration using the --path
option. The path is relative to the application's base path.
php artisan make:migration --path=app/Modules/User/Migrations