laravel drop column with foreign key code example

Example 1: larael drop foreign key

Schema::table('posts', function (Blueprint $table) {
	$table->dropForeign(['category_id']);
});

Example 2: laravel remove foreign key

$table->dropForeign('posts_user_id_foreign');

Example 3: laravel drop foreign column

// Searched, laravel drop foreign column
Schema::table('users', function (Blueprint $table) {
    $table->dropColumn(['votes', 'avatar', 'location']);
});

Example 4: laravel migration drop foreign keys

$table->dropPrimary('users_id_primary');

Example 5: laravel longblob migration

DB::statement("ALTER TABLE <table name> ADD <column name> MEDIUMBLOB");

Tags:

Sql Example