set null with migration laravel code example
Example 1: laravel migration on delete set null
$table->...->onDelete('set null');
Example 2: laravel 7 eloquent on delete set null schema
$table->foreignId('user_id')
->constrained()
->onDelete('cascade');