Answers for "laravel drop foreign key if exists"

PHP
1

larael drop foreign key

Schema::table('posts', function (Blueprint $table) {
	$table->dropForeign(['category_id']);
});
Posted by: Guest on May-07-2021
3

laravel remove foreign key

$table->dropForeign('posts_user_id_foreign');
Posted by: Guest on April-22-2020
0

laravel check if primary key exists

$keyExists = DB::select(
    DB::raw(
        'SHOW KEYS
        FROM your_table_name
        WHERE Key_name=\'your_key_name\''
    )
);
Posted by: Guest on April-30-2020
0

drop foreign key laravel

Schema::table('admins', function (Blueprint $table) {    $table->dropForeign('admins_post_id_foreign');    $table->dropColumn('post_id');});
Posted by: Guest on September-26-2021

Code answers related to "laravel drop foreign key if exists"

Browse Popular Code Answers by Language