From fe3bc466366447c13fbc30d6753468737a09106d Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 4 Aug 2021 17:42:26 +0200 Subject: [PATCH] Aircraft Airport Relation --- README.md | 2 +- models/Aircraft.php | 2 ++ models/aircraft/columns.yaml | 12 ++++++++---- models/aircraft/fields.yaml | 6 ++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bfa325b..88e4674 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ - BelongsTo AircraftType - BelongsToMany AircraftTypeGroup -- **TODO, 2x** BelongsTo Airport (External DB) +- BelongsTo Airport (2x, External DB, creation in Routes Plugin) ## AircraftTypeGroup diff --git a/models/Aircraft.php b/models/Aircraft.php index 4cf744a..cf38fcd 100644 --- a/models/Aircraft.php +++ b/models/Aircraft.php @@ -33,5 +33,7 @@ class Aircraft extends Model public $belongsTo = [ 'aircraft_type' => 'GermanAirlinesVa\Fleet\Models\AircraftType', + 'home_airport' => 'GermanAirlinesVa\Routes\Models\Airport', + 'airport' => 'GermanAirlinesVa\Routes\Models\Airport', ]; } diff --git a/models/aircraft/columns.yaml b/models/aircraft/columns.yaml index 1d3f035..0afa43a 100644 --- a/models/aircraft/columns.yaml +++ b/models/aircraft/columns.yaml @@ -7,12 +7,16 @@ columns: type: text relation: aircraft_type valueFrom: type - home_airport_id: - label: home_airport_id + home_airport: + label: home_airport type: text - airport_id: - label: airport_id + relation: home_airport + valueFrom: icao + airport: + label: airport type: text + relation: airport + valueFrom: icao name: label: name type: text diff --git a/models/aircraft/fields.yaml b/models/aircraft/fields.yaml index ae82fbe..4592f2a 100644 --- a/models/aircraft/fields.yaml +++ b/models/aircraft/fields.yaml @@ -16,8 +16,10 @@ fields: span: auto required: 1 type: text - home_airport_id: + home_airport: label: 'germanairlinesva.fleet::lang.aircrafts.home_base' + nameFrom: name + descriptionFrom: description span: auto required: 1 - type: number + type: relation