laravel 8 $table->foreign Id('user_id')->constraint()->cascade Delete(); code example
Example 1: laravel migration add unique column
Schema::table('tableName', function($table)
{
$table->string('column-name')->unique(); //notice the parenthesis I added
});
Example 2: cascade in laravel migration
$table->dropForeign('answers_user_id_foreign');
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
Example 3: laravel migration drop foreign keys
$table->dropIndex(['state']); // Drops index 'geo_state_index'