76 lines
1.5 KiB
PHP
76 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Flight
|
|
*
|
|
* @property int $id
|
|
* @property int $travel_type_id
|
|
* @property string $flight_number
|
|
* @property string $airline_name
|
|
* @property string $origin
|
|
* @property string $destination
|
|
* @property Carbon $departure_date
|
|
* @property Carbon $departure_time
|
|
* @property Carbon $arrival_date
|
|
* @property Carbon $arrival_time
|
|
* @property string $duration
|
|
* @property float $price
|
|
* @property int $capacity
|
|
* @property int $status
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
*
|
|
* @property Collection|Tour[] $tours
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class Flight extends Model
|
|
{
|
|
protected $table = 'flights';
|
|
public static $snakeAttributes = false;
|
|
|
|
protected $casts = [
|
|
'travel_type_id' => 'int',
|
|
'departure_date' => 'datetime',
|
|
'departure_time' => 'datetime',
|
|
'arrival_date' => 'datetime',
|
|
'arrival_time' => 'datetime',
|
|
'price' => 'float',
|
|
'capacity' => 'int',
|
|
'status' => 'int'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'travel_type_id',
|
|
'flight_number',
|
|
'airline_name',
|
|
'origin',
|
|
'destination',
|
|
'departure_date',
|
|
'departure_time',
|
|
'arrival_date',
|
|
'arrival_time',
|
|
'duration',
|
|
'price',
|
|
'capacity',
|
|
'status'
|
|
];
|
|
|
|
public function tours()
|
|
{
|
|
return $this->belongsToMany(Tour::class, 'tour_flights')
|
|
->withPivot('id')
|
|
->withTimestamps();
|
|
}
|
|
}
|