Answers for "how to add foreign key in laravel migration to existing table"

PHP
6

foreign key in laravel migration

$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
Posted by: Guest on June-21-2021
5

foreign key laravel migration

$table->foreign('column_name')->references('id')->on('table_name')->onDelete('cascade');
Posted by: Guest on February-05-2021

Code answers related to "how to add foreign key in laravel migration to existing table"

Browse Popular Code Answers by Language