Laravel 7 migration add column after or before

Laravel 7

Nicesnippets

148

02-04-2020


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...