Laravel 7 migration add column after or before

10-Apr-2023

.

Admin

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

#Laravel 7