프로젝트/[Laravel Breeze] 레스토랑 예약 프로그램
[laravel] 4. migration
테렌테렌
2022. 6. 30. 17:34
public function up()
{
Schema::create('tables', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->integer('guest_number');
$table->string('status')->default('avaliable');
$table->string('location');
$table->timestamps();
});
}
php artisan make:model Category -m
php artisan make:model Menu -m
php artisan make:model Table -m
php artisan make:model Reservation -m
php artisan migrate
1. create_categories_table.php
public function up()
{
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description');
$table->string('image');
$table->timestamps();
});
}
2. create_menus_table.php
public function up()
{
Schema::create('menus', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description');
$table->string('image');
$table->decimal('price', 10, 2);
$table->timestamps();
});
}
3. create_tables_table.php
public function up()
{
Schema::create('tables', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->integer('guest_number');
$table->string('status')->default('avaliable');
$table->string('location');
$table->timestamps();
});
}
4. create_reservations_table.php
public function up()
{
Schema::create('reservations', function (Blueprint $table) {
$table->id();
$table->string('first_name');
$table->string('last_name');
$table->string('email');
$table->string('tel_number');
$table->dateTime('res_date');
$table->unsignedBigInteger('table_id');
$table->integer('guest_number');
$table->timestamps();
});
}