Laravel 7 migration add column after or before

Admin   Laravel   219  2021-03-17 17:50:04

Hello Friends,

In this blog we are learn how to add column in table using migration. we are provide syntex of add column after column or before column migration. first you have to create migration using following command.

Add Before column is not available in laravel.

Migration Create Command

 

php artisan make:migration add_status_column_to_users_table --table=users

Add Column After

 

public function up()

{

Schema::table('users', function (Blueprint $table) {

$table->tinyInteger('status')->after('password');

});

}

I hope it can help you...