Search
 
SCRIPT & CODE EXAMPLE
 

PHP

make a forign key in migrations using laravel 8

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

create foreign key laravel migration

Schema::table('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});
Comment

laravel 8 foreign key migration

use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;

Schema::table('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});
Comment

foreign key laravel migration

$table->foreign('column_name')->references('id')->on('table_name')->onDelete('cascade');
Comment

Laravel migrations custom foreign key

$table->unsignedBigInteger('created_by');
$table->foreign('created_by')->references('id')->on('users');
Comment

PREVIOUS NEXT
Code Example
Php :: laravel migration price 
Php :: symlink in php 
Php :: php difference between two dates in years months and days 
Php :: php copy file 
Php :: button back php 
Php :: first character uppercase php 
Php :: how to check the laravel version mac 
Php :: full url php 
Php :: php get only numbers from string 
Php :: start server in laravel 
Php :: php delete array item by value not key 
Php :: seconds to minutes php 
Php :: php get current year 
Php :: find type in php 
Php :: php force array keys to lowercase 
Php :: Wordpress disable plugin or theme installation 
Php :: php sha256 example 
Php :: array merge laravel 
Php :: laravel append array to array 
Php :: php set error log file 
Php :: laravel print request data 
Php :: wp+get feature image 
Php :: php artisan migrate nothing to migrate 
Php :: woocommerce custom sale banner, sash 
Php :: laravel check if get is empty 
Php :: laravel collection tojson 
Php :: php get remote file last modified 
Php :: unique validation on update laravel 
Php :: php copy url 
Php :: php check if string email 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =