Answers for "laravel foreign key on delete cascade"

PHP
3

cascade in laravel migration

$table->dropForeign('answers_user_id_foreign');
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
Posted by: Guest on December-18-2020
2

how work cascade laravel

Schema::create('posts', function (Blueprint $table) {
    $table->increments('id');
    $table->integer('author')->unsigned();
    $table->timestamps();
    $table->foreign('author')->references('id')->on('users')->onUpdate('cascade');
});
Posted by: Guest on July-19-2021
1

cascade laravel

Schema::create('posts', function (Blueprint $table) {
    $table->id();
    $table->foreignId('author')->constrained('users')->onDelete('cascade')->onUpdate('cascade');
    $table->timestamps();
});
Posted by: Guest on July-25-2021
3

laravel remove foreign key

$table->dropForeign('posts_user_id_foreign');
Posted by: Guest on April-22-2020
0

laravel migration drop foreign keys

$table->dropPrimary('users_id_primary');
Posted by: Guest on November-30-2020
0

how set cascade on delete and update in same time in laravel

$table->foreign('user_id')->references('id')->on('users')
->onDelete('SET NULL')
->onUpdate('SET NULL'); // also available CASCADE, RESTRICT, DO NOTHING, NO ACTION
Posted by: Guest on July-22-2021

Code answers related to "laravel foreign key on delete cascade"

Browse Popular Code Answers by Language