delete foreign key entry data laravel code example
Example 1: larael drop foreign key
Schema::table('posts', function (Blueprint $table) {
$table->dropForeign(['category_id']);
});
Example 2: set null on foreign key deletion in laravel
$table->foreignId('forign_id')->nullable()->constrained("table_name")->cascadeOnUpdate()->nullOnDelete();