Answers for "conditional to add a foreign key in laravel migration"

PHP
1

Laravel adding Foreign Key Constraints

$table->foreignId('user_id')
      ->constrained("users") <- // You don't need to specify table if it matched laravel naming conventions.
      ->onUpdate('cascade')
      ->onDelete('cascade');
Posted by: Guest on June-16-2021

Code answers related to "conditional to add a foreign key in laravel migration"

Browse Popular Code Answers by Language