+ availability

This commit is contained in:
2026-01-26 09:06:06 +00:00
parent 18aad4749f
commit a448fce756
34 changed files with 1089 additions and 578 deletions

View File

@@ -15,7 +15,7 @@ return new class extends Migration
$table->id();
$table->foreignId('hotel_id')->constrained()->onDelete('cascade');
$table->string('name');
$table->integer('capacity');
$table->integer('capacity')->nullable()->default(2)->change();
$table->decimal('base_price', 10, 2);
$table->timestamps();
});
@@ -24,8 +24,10 @@ return new class extends Migration
/**
* Reverse the migrations.
*/
public function down(): void
public function down()
{
Schema::dropIfExists('room_types');
Schema::table('room_types', function (Blueprint $table) {
$table->integer('capacity')->default(2)->change();
});
}
};

View File

@@ -9,24 +9,21 @@ return new class extends Migration
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('bookings', function (Blueprint $table) {
$table->id();
$table->string('booking_number')->nullable();
$table->foreignId('room_type_id')->constrained()->onDelete('cascade');
$table->date('check_in');
$table->date('check_out');
$table->string('guest_name');
$table->string('guest_email')->nullable();
$table->string('guest_phone')->nullable();
$table->enum('status', ['pending', 'confirmed', 'cancelled', 'completed'])->default('pending');
$table->enum('confirmation_type', ['auto', 'manual'])->default('auto');
$table->unsignedBigInteger('created_by_user_id')->nullable();
$table->timestamp('confirmed_at')->nullable();
$table->timestamps();
});
}
public function up()
{
Schema::create('bookings', function (Blueprint $table) {
$table->id();
$table->foreignId('room_type_id')->constrained()->onDelete('cascade');
$table->date('check_in');
$table->date('check_out');
$table->string('guest_name');
$table->string('guest_email');
$table->string('guest_phone')->nullable();
$table->boolean('is_confirmed')->default(false);
$table->decimal('total_price', 10, 2)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.

View File

@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create('availabilities', function (Blueprint $table) {
$table->id();
$table->foreignId('room_type_id')->constrained()->onDelete('cascade');
$table->date('start_date');
$table->date('end_date');
$table->boolean('is_available')->default(true);
$table->decimal('price', 8, 2)->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('availabilities');
}
};

View File

@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table('room_types', function (Blueprint $table) {
$table->text('description')->nullable()->after('name');
});
}
public function down()
{
Schema::table('room_types', function (Blueprint $table) {
$table->dropColumn('description');
});
}
};

View File

@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table('room_types', function (Blueprint $table) {
$table->integer('max_guests')->default(2)->after('description');
});
}
public function down()
{
Schema::table('room_types', function (Blueprint $table) {
$table->dropColumn('max_guests');
});
}
};

View File

@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table('room_types', function (Blueprint $table) {
// Изменяем capacity: делаем nullable и добавляем default
$table->integer('capacity')->nullable()->default(2)->change();
});
}
public function down()
{
Schema::table('room_types', function (Blueprint $table) {
$table->integer('capacity')->default(2)->change();
});
}
};

View File

@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table('room_types', function (Blueprint $table) {
// Изменяем base_price: делаем nullable и добавляем default
$table->decimal('base_price', 8, 2)->nullable()->default(5000.00)->change();
});
}
public function down()
{
Schema::table('room_types', function (Blueprint $table) {
$table->decimal('base_price', 8, 2)->default(5000.00)->change();
});
}
};