Answers for "laravel migration text"

PHP
21

laravel foreign key

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

    $table->foreign('user_id')->references('id')->on('users');
});
OR
Schema::table('posts', function (Blueprint $table) {
    $table->foreignId('user_id')->constrained();
});
Posted by: Guest on December-09-2020
0

long text in laravel migration

Schema::create('posts', function ($table) {
    $table->increments('id');
    $table->integer('user_id');
    // ...
    $table->longText('description');
    // ...
}
Posted by: Guest on September-04-2021
2

migrations required field laravel

$table->string('foo')->nullable(false)->change();
Posted by: Guest on May-07-2020
3

laravel migration integer

$table->bigInteger('votes');
Posted by: Guest on May-22-2020
2

laravel make migration

php artisan make:migration CreateUsersTable
Posted by: Guest on May-04-2020

Code answers related to "laravel migration text"

Browse Popular Code Answers by Language