33 lines
748 B
PHP
33 lines
748 B
PHP
<?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);
|
|
}
|
|
}
|