Answers for "laravel migration change primary key to foreign key"

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
2

laravel migration with primary key

$table->string('code', 30)->primary();
Posted by: Guest on May-24-2021

Code answers related to "laravel migration change primary key to foreign key"

Browse Popular Code Answers by Language