“Utwórz tabelę Laravel” Kod odpowiedzi

Laravel zagraniczny klucz

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

Utwórz tabelę Laravel

php artisan make:migration create_table_name --create=tablel_name
php artisan migrate  
Snippets

Laravel tworzy migrację

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

Jak zmienić istniejącą migrację Laravel

php artisan make:migration update_user_guide_in_product_translations_table
Grieving Gaur

Migracje wymagane pola Laravela

$table->string('foo')->nullable(false)->change();
r00ster

Utwórz tabelę Laravel

php artisan make:migration create_employeeDetails_table --create=Employee
//goto create_employeeDetails_table file and add fields in table
php artisan migrate  
MR. D

Odpowiedzi podobne do “Utwórz tabelę Laravel”

Pytania podobne do “Utwórz tabelę Laravel”

Więcej pokrewnych odpowiedzi na “Utwórz tabelę Laravel” w PHP

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu