Laravel foreign key onDelete('cascade') not working
Try setting when trying to create this table. This fix has worked for me.
$table->engine = 'InnoDB';
I have filed a bug under: https://github.com/laravel/framework/issues/8730
It is established by Jake's answer that you have set default engine to InnoDB
$table->engine = 'InnoDB';
Instead of doing it in each migration file, You can do so in config/database.php
'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => false, 'engine' => 'InnoDB', ],
Check the MySQL config. my.ini may still have default-storage-engine=MYISAM
. Set to default-storage-engine=InnoDB
and you should avoid the trouble of adding this fix to each migration.