30 lines
949 B
PHP
30 lines
949 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('rentals', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('car_id')->constrained()->onDelete('cascade');
|
|
$table->foreignId('customer_id')->constrained()->onDelete('cascade');
|
|
$table->date('start_date');
|
|
$table->date('end_date');
|
|
$table->decimal('total_amount', 10, 2);
|
|
$table->decimal('advance_payment', 10, 2)->default(0);
|
|
$table->enum('status', ['pending', 'active', 'completed', 'cancelled'])->default('pending');
|
|
$table->text('notes')->nullable();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('rentals');
|
|
}
|
|
};
|