Search
 
SCRIPT & CODE EXAMPLE
 

PHP

cascade in laravel migration

$table->dropForeign('answers_user_id_foreign');
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
Comment

cascade laravel

Schema::create('posts', function (Blueprint $table) {
    $table->id();
    $table->foreignId('author')->constrained('users')->onDelete('cascade')->onUpdate('cascade');
    $table->timestamps();
});
Comment

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');
});
Comment

PREVIOUS NEXT
Code Example
Php :: date 3 months ago for a particular date php 
Php :: laravel get authorization bearer token 
Php :: echo session 
Php :: get ip in laravel 
Php :: laravel session add array 
Php :: php get php.ini location from termina 
Php :: turn text file to string php 
Php :: php create from format 
Php :: php set array 
Php :: php array formatted output 
Php :: laravel loop through collection 
Php :: cmd run powershell command 
Php :: convert comma separated number to number in php 
Php :: current user laravel 
Php :: laravel add timestamps to existing table 
Php :: start php server 
Php :: php check if folder empty 
Php :: how to add new column in laravel migration 
Php :: php repeat string 
Php :: php how to write at end of the sentence 
Php :: How to send data from PHP to Python 
Php :: how to reverse fetch assoc in php 
Php :: PHP strrev — Reverse a string 
Php :: php iterate array keys 
Php :: remove first character from string laravel 
Php :: php check if query returns results 
Php :: artisan show routes for model 
Php :: laravel check if field has changed 
Php :: sortbydesc on a collection laravel 
Php :: fill zero on php 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =