Aircraft level Hub definitions (#1363)

* Aircraft level Hub definitions

* Add ability to define a hub for an aircraft apart from its subfleet.

* Update csv import/export capability for hub_id field

* Fix importertest source csv

* Fix source csv for updating too

* Update aircraft_empty_cols.csv

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
This commit is contained in:
B.Fatih KOZ
2021-11-30 22:54:29 +03:00
committed by GitHub
parent 4d21ca0982
commit c45d52dffa
10 changed files with 50 additions and 16 deletions

View File

@@ -13,6 +13,7 @@ use Znck\Eloquent\Traits\BelongsToThrough;
* @property int id
* @property mixed subfleet_id
* @property string airport_id The apt where the aircraft is
* @property string hub_id The apt where the aircraft is based
* @property string ident
* @property string name
* @property string icao
@@ -22,6 +23,7 @@ use Znck\Eloquent\Traits\BelongsToThrough;
* @property float zfw
* @property string hex_code
* @property Airport airport
* @property Airport hub
* @property Subfleet subfleet
* @property int status
* @property int state
@@ -39,6 +41,7 @@ class Aircraft extends Model
protected $fillable = [
'subfleet_id',
'airport_id',
'hub_id',
'iata',
'icao',
'name',
@@ -127,6 +130,11 @@ class Aircraft extends Model
return $this->belongsTo(Airport::class, 'airport_id');
}
public function hub()
{
return $this->hasOne(Airport::class, 'id', 'hub_id');
}
public function pireps()
{
return $this->hasMany(Pirep::class, 'aircraft_id');