Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel foreign key constraint

public function up()
{
    Schema::create('replies', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->text('body');
        $table->unsignedBigInteger('question_id');
        $table->integer('user_id')->unsigned();
        $table->foreign('question_id')->references('id')->on('questions')->onDelete('cascade');
        $table->timestamps();
    });
}
Comment

foreign key cosntraint laravel

public function up()
{
    Schema::create('priorities', function($table) {
        $table->increments('id', true);
        $table->integer('user_id')->unsigned();
        $table->string('priority_name');
        $table->smallInteger('rank');
        $table->text('class');
        $table->timestamps('timecreated');
    });

   Schema::table('priorities', function($table) {
       $table->foreign('user_id')->references('id')->on('users');
   });

}
Comment

PREVIOUS NEXT
Code Example
Php :: php exec get pid 
Php :: internal server error phpmyadmin 
Php :: Round the number in php 
Php :: php indexof 
Php :: laravel permissions 
Php :: isempty php 
Php :: convert multdimentional array in array in php 
Php :: file put contents php 
Php :: substract two datetime and get the different hours and minutes php 
Php :: woocommerce get the price from session after add to cart 
Php :: laravel validate form data unique 
Php :: include blade file in laravel 
Php :: json_encode alternative 
Php :: laravel search multiple (related) tables 
Php :: magento2 get full details of order collection using root script 
Php :: Creating Laravel and Vue Project 
Php :: laravel validation numeric vs integer 
Php :: acf get image id sub_field 
Php :: php random filename generator 
Php :: How do I change the URL of Add to cart in WooCommerce 
Php :: livewire call function from other component 
Php :: get node url from id twig 
Php :: laravel post request page csrf disable 
Php :: json encode php 
Php :: laravel s3 download file 
Php :: utc time php 
Php :: how-to-generate-an-xlsx-using-php 
Php :: add key value array php 
Php :: active page in laravel 
Php :: get shipping price of choosen shipping method woocommerce 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =