61 lines
1.8 KiB
PHP
61 lines
1.8 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('reservasi', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
|
$table->foreignId('meja_id')->constrained('meja')->onDelete('cascade');
|
|
$table->string('name');
|
|
$table->string('phone');
|
|
$table->date('date');
|
|
$table->time('start_time');
|
|
$table->decimal('total_harga', 10, 2)->default(0);
|
|
$table->enum('payment_method', [
|
|
'credit_card',
|
|
'mandiri_clickpay',
|
|
'cimb_clicks',
|
|
'bca_klikbca',
|
|
'bca_klikpay',
|
|
'bri_epay',
|
|
'echannel',
|
|
'permata_va',
|
|
'bca_va',
|
|
'bni_va',
|
|
'bri_va',
|
|
'other_va',
|
|
'gopay',
|
|
'shopeepay',
|
|
'qris',
|
|
'indomaret',
|
|
'alfamart',
|
|
'danamon_online',
|
|
'akulaku'
|
|
])->nullable();
|
|
$table->enum('status', ['pending', 'confirmed', 'completed', 'cancelled'])->default('pending');
|
|
$table->text('notes')->nullable();
|
|
$table->timestamps();
|
|
|
|
// Add index for common queries
|
|
$table->index(['meja_id', 'date', 'status']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('reservasi');
|
|
}
|
|
};
|