Initial commit - Car Rental Management System

This commit is contained in:
Innovator committed 2026-02-19 22:05:20 +00:00
commit f72173377a
100 files changed
+15201

No files matched your search

@@ -0,0 +1,49 @@
<?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('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
@@ -0,0 +1,35 @@
<?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('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
@@ -0,0 +1,57 @@
<?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('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};
@@ -0,0 +1,31 @@
<?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');
}
};
@@ -0,0 +1,30 @@
<?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('customers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('phone');
$table->string('address');
$table->string('license_number');
$table->date('license_expiry');
$table->date('dob');
$table->enum('status', ['active', 'inactive', 'blocked'])->default('active');
$table->text('notes')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('customers');
}
};
@@ -0,0 +1,29 @@
<?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');
}
};
@@ -0,0 +1,29 @@
<?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('services', function (Blueprint $table) {
$table->id();
$table->foreignId('car_id')->constrained()->onDelete('cascade');
$table->enum('type', ['oil_change', 'tire_rotation', 'brake_service', 'general_checkup', 'repair', 'insurance', 'other']);
$table->text('description');
$table->decimal('cost', 10, 2);
$table->date('service_date');
$table->date('next_service_date')->nullable();
$table->integer('mileage_at_service')->nullable();
$table->enum('status', ['scheduled', 'in_progress', 'completed'])->default('completed');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('services');
}
};
@@ -0,0 +1,27 @@
<?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('payments', function (Blueprint $table) {
$table->id();
$table->foreignId('rental_id')->constrained()->onDelete('cascade');
$table->decimal('amount', 10, 2);
$table->enum('method', ['cash', 'card', 'bank_transfer', 'online', 'other']);
$table->enum('status', ['pending', 'completed', 'failed', 'refunded'])->default('completed');
$table->string('transaction_id')->nullable();
$table->text('notes')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('payments');
}
};
@@ -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(): void
{
Schema::table('rentals', function (Blueprint $table) {
$table->enum('rental_type', ['daily', 'weekly', 'monthly', 'lease'])->default('daily')->after('end_date');
});
}
public function down(): void
{
Schema::table('rentals', function (Blueprint $table) {
$table->dropColumn('rental_type');
});
}
};
@@ -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(): void
{
Schema::table('rentals', function (Blueprint $table) {
$table->time('pickup_time')->nullable()->after('start_date');
$table->time('return_time')->nullable()->after('end_date');
});
}
public function down(): void
{
Schema::table('rentals', function (Blueprint $table) {
$table->dropColumn(['pickup_time', 'return_time']);
});
}
};
@@ -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(): void
{
Schema::table('rentals', function (Blueprint $table) {
$table->text('customer_signature')->nullable()->after('notes');
});
}
public function down(): void
{
Schema::table('rentals', function (Blueprint $table) {
$table->dropColumn('customer_signature');
});
}
};