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

+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Car extends Model
{
protected $fillable = ['brand', 'model', 'year', 'license_plate', 'color', 'daily_rate', 'status', 'image', 'mileage', 'notes'];
public function rentals()
{
return $this->hasMany(Rental::class);
}
public function services()
{
return $this->hasMany(Service::class);
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Customer extends Model
{
protected $fillable = ['name', 'email', 'phone', 'address', 'license_number', 'license_expiry', 'dob', 'status', 'notes'];
public function rentals()
{
return $this->hasMany(Rental::class);
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Payment extends Model
{
protected $fillable = ['rental_id', 'amount', 'method', 'status', 'transaction_id', 'notes'];
public function rental()
{
return $this->belongsTo(Rental::class);
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Rental extends Model
{
protected $fillable = ['car_id', 'customer_id', 'start_date', 'end_date', 'total_amount', 'advance_payment', 'status', 'notes', 'rental_type', 'pickup_time', 'return_time', 'customer_signature'];
protected $casts = [
'start_date' => 'date',
'end_date' => 'date',
'pickup_time' => 'datetime:H:i',
'return_time' => 'datetime:H:i',
];
public function car()
{
return $this->belongsTo(Car::class);
}
public function customer()
{
return $this->belongsTo(Customer::class);
}
public function payments()
{
return $this->hasMany(Payment::class);
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Service extends Model
{
protected $fillable = ['car_id', 'type', 'description', 'cost', 'service_date', 'next_service_date', 'mileage_at_service', 'status'];
protected $casts = [
'service_date' => 'date',
'next_service_date' => 'date',
];
public function car()
{
return $this->belongsTo(Car::class);
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}