<?php
use IlluminateSupportFacadesSchema;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateDatabaseMigrationsMigration;
class AddStoreIdToUsersTable extends Migration
{
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->integer('store_id')->unsigned()->nullable()->after('password');
$table->foreign('store_id')->references('id')->on('stores')->onDelete('SET NULL');
});
}
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropForeign(['store_id']);
$table->dropColumn('store_id');
});
}
}