“Как создать миграцию в Ларавеле” Ответ

PHP Artisan Migrate Create Table

php artisan make:migration create_users_table

php artisan migrate
Shadow

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();
});
Courageous Cod

PHP ремесленник совершает миграцию

php artisan make:migration create_users_table
Mobile Star

Ларавел создает миграцию

// use the make:migration Artisan command to generate a database migration
php artisan make:migration create_flights_table

// use --create to indicate whether the migration will be creating a new table
php artisan make:migration create_flights_table --create=flights

// use --table to indicate the table name
php artisan make:migration add_destination_to_flights_table --table=flights
Yingfufu

Как создать миграцию в Ларавеле

$table->increments('id');
Jittery Jay

ремесленник совершает миграцию с моделью

php artisan make:Model Status -m
Adorable Aardvark

Ответы похожие на “Как создать миграцию в Ларавеле”

Вопросы похожие на “Как создать миграцию в Ларавеле”

Больше похожих ответов на “Как создать миграцию в Ларавеле” по PHP

Смотреть популярные ответы по языку

Смотреть другие языки программирования