59 lines
1.0 KiB
PHP
59 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Airport
|
|
*
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property int $city_id
|
|
* @property int $status
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
*
|
|
* @property City $city
|
|
* @property Collection|Flight[] $flights
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class Airport extends Model
|
|
{
|
|
protected $table = 'airports';
|
|
public static $snakeAttributes = false;
|
|
|
|
protected $casts = [
|
|
'city_id' => 'int',
|
|
'status' => 'int'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'city_id',
|
|
'status'
|
|
];
|
|
|
|
public function city()
|
|
{
|
|
return $this->belongsTo(City::class);
|
|
}
|
|
|
|
public function originFlights()
|
|
{
|
|
return $this->hasMany(Flight::class, 'origin_airport_id');
|
|
}
|
|
|
|
public function destinationFlights()
|
|
{
|
|
return $this->hasMany(Flight::class, 'destination_airport_id');
|
|
}
|
|
}
|