“Comment créer une migration dans Laravel” Réponses codées

PHP Artisan Migrate Create Table

php artisan make:migration create_users_table

php artisan migrate
Shadow

Clé étrangère de Laravel

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 Artisan fait la migration

php artisan make:migration create_users_table
Mobile Star

Laravel crée une migration

// 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

Comment créer une migration dans Laravel

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

artisan fait la migration avec le modèle

php artisan make:Model Status -m
Adorable Aardvark

Réponses similaires à “Comment créer une migration dans Laravel”

Questions similaires à “Comment créer une migration dans Laravel”

Plus de réponses similaires à “Comment créer une migration dans Laravel” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code