57 lines
1.1 KiB
PHP
57 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\BookingStatus;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Booking extends Model
|
|
{
|
|
protected $table = 'bookings';
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $casts = [
|
|
'user_id' => 'int',
|
|
'flight_id' => 'int',
|
|
'tour_id' => 'int',
|
|
'adult_count' => 'int',
|
|
'child_count' => 'int',
|
|
'total_price' => 'int',
|
|
'status' => BookingStatus::class,
|
|
'created_at' => 'datetime',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'flight_id',
|
|
'tour_id',
|
|
'adult_count',
|
|
'child_count',
|
|
'total_price',
|
|
'tracking_code',
|
|
'status',
|
|
'created_at',
|
|
];
|
|
|
|
public function flight()
|
|
{
|
|
return $this->belongsTo(Flight::class);
|
|
}
|
|
|
|
public function tour()
|
|
{
|
|
return $this->belongsTo(Tour::class, 'tour_id');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function passengers()
|
|
{
|
|
return $this->hasMany(BookingPassenger::class);
|
|
}
|
|
}
|