Answers for "foreign column name null laravel"

PHP
5

laravel migration make column nullable

Schema::table('users', function($table)
{
    $table->string('name', 50)->nullable()->change();
});

This is the correct syntax to revert the migration:

$table->integer('user_id')->unsigned()->nullable(false)->change();
Posted by: Guest on January-21-2021
2

foreign key nullable in laravel

$table
      ->foreignId('other_table_id')
      ->nullable() // here
      ->references('id')
      ->on('other_table');
Posted by: Guest on October-01-2021

Code answers related to "foreign column name null laravel"

Browse Popular Code Answers by Language