91 lines
1.7 KiB
PHP
91 lines
1.7 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 string $title
|
|
* @property string $summary
|
|
* @property int $arrival_aiport_id
|
|
* @property int $file_id
|
|
* @property int $flight_type
|
|
* @property int $departure_time
|
|
* @property float $price
|
|
* @property int $deprature_airport_id
|
|
* @property string $destination
|
|
* @property int $airline_id
|
|
* @property int $capacity
|
|
* @property int $status
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
*
|
|
* @property Airline $airline
|
|
* @property File $file
|
|
* @property Airport $airport
|
|
* @property Collection|Booking[] $bookings
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class Flight extends Model
|
|
{
|
|
protected $table = 'flights';
|
|
public static $snakeAttributes = false;
|
|
|
|
protected $casts = [
|
|
'arrival_aiport_id' => 'int',
|
|
'file_id' => 'int',
|
|
'flight_type' => 'int',
|
|
'departure_time' => 'int',
|
|
'price' => 'float',
|
|
'deprature_airport_id' => 'int',
|
|
'airline_id' => 'int',
|
|
'capacity' => 'int',
|
|
'status' => 'int'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'title',
|
|
'summary',
|
|
'arrival_aiport_id',
|
|
'file_id',
|
|
'flight_type',
|
|
'departure_time',
|
|
'price',
|
|
'deprature_airport_id',
|
|
'destination',
|
|
'airline_id',
|
|
'capacity',
|
|
'status'
|
|
];
|
|
|
|
public function airline()
|
|
{
|
|
return $this->belongsTo(Airline::class);
|
|
}
|
|
|
|
public function file()
|
|
{
|
|
return $this->belongsTo(File::class);
|
|
}
|
|
|
|
public function airport()
|
|
{
|
|
return $this->belongsTo(Airport::class, 'deprature_airport_id');
|
|
}
|
|
|
|
public function bookings()
|
|
{
|
|
return $this->hasMany(Booking::class);
|
|
}
|
|
}
|