Answers for "adding a new foreign key column to a database in laravel"

PHP
5

foreign key laravel migration

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

Laravel create foreign key column in migration

$table->foreignId('post_id')
                ->constrained()
                ->onUpdate('cascade')
                ->onDelete('cascade');
Posted by: Guest on July-18-2021

Code answers related to "adding a new foreign key column to a database in laravel"

Browse Popular Code Answers by Language