carrentalservice/database/migrations/2026_02_19_091505_create_cars_table.php
2026-02-19 22:05:20 +00:00

32 lines
941 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('cars', function (Blueprint $table) {
$table->id();
$table->string('brand');
$table->string('model');
$table->string('year');
$table->string('license_plate')->unique();
$table->string('color');
$table->decimal('daily_rate', 10, 2);
$table->enum('status', ['available', 'rented', 'maintenance', 'sold'])->default('available');
$table->string('image')->nullable();
$table->integer('mileage')->default(0);
$table->text('notes')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('cars');
}
};