51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
<?php namespace GermanAirlinesVa\Routes\Models;
|
|
|
|
use Model;
|
|
|
|
/**
|
|
* Model
|
|
*/
|
|
class Airport extends Model
|
|
{
|
|
use \October\Rain\Database\Traits\Validation;
|
|
|
|
/*
|
|
* Disable timestamps by default.
|
|
* Remove this line if timestamps are defined in the database table.
|
|
*/
|
|
public $timestamps = false;
|
|
|
|
/**
|
|
* @var string The database table used by the model.
|
|
*/
|
|
public $table = 'airports';
|
|
protected $connection = 'germanairlinesva_routes';
|
|
|
|
/**
|
|
* @var array Validation rules
|
|
*/
|
|
public $rules = [
|
|
'iata' => 'required',
|
|
'icao' => 'required',
|
|
'name' => 'required',
|
|
'country' => 'required',
|
|
'elevation' => 'required',
|
|
'latitude' => 'required',
|
|
'longitude' => 'required',
|
|
];
|
|
|
|
public $hasMany = [
|
|
'based' => ['GermanAirlinesVa\Fleet\Models\Aircraft', 'key' => 'home_airport_id'],
|
|
'occupying' => ['GermanAirlinesVa\Fleet\Models\Aircraft', 'key' => 'airport_id'],
|
|
];
|
|
|
|
public $belongsToMany = [
|
|
'alternates' => [
|
|
'GermanAirlinesVa\Routes\Models\Airport',
|
|
'table' => 'alternates',
|
|
'key' => 'airport_id',
|
|
'otherKey' => 'alternate_id',
|
|
],
|
|
];
|
|
}
|