laravel foreign key on delete set null code example
Example 1: laravel migration on delete set null
$table->...->onDelete('set null');
Example 2: set null on foreign key deletion in laravel
$table->foreignId('forign_id')->nullable()->constrained("table_name")->cascadeOnUpdate()->nullOnDelete();
Example 3: laravel 7 eloquent on delete set null schema
$table->foreignId('user_id')
->constrained()
->onDelete('cascade');