diff --git a/app/Database/seeds/sample.yml b/app/Database/seeds/sample.yml index 6a0680e6..30f449a1 100644 --- a/app/Database/seeds/sample.yml +++ b/app/Database/seeds/sample.yml @@ -411,6 +411,12 @@ flight_field_values: flight_subfleet: - subfleet_id: 1 flight_id: flightid_1 + - subfleet_id: 1 + flight_id: flightid_2 + - subfleet_id: 1 + flight_id: flightid_3 + - subfleet_id: 1 + flight_id: flightid_4 bids: - id: 100 diff --git a/app/Http/Resources/Flight.php b/app/Http/Resources/Flight.php index 59685adc..1fd9cff7 100644 --- a/app/Http/Resources/Flight.php +++ b/app/Http/Resources/Flight.php @@ -25,6 +25,8 @@ class Flight extends Resource { $flight = parent::toArray($request); + $flight['ident'] = $this->ident; + // Return multiple measures so the client can pick what they want if ($this->distance instanceof Distance) { $flight['distance'] = $this->distance->units; diff --git a/app/Http/Resources/UserBid.php b/app/Http/Resources/UserBid.php index b48c717c..3c87fdfc 100644 --- a/app/Http/Resources/UserBid.php +++ b/app/Http/Resources/UserBid.php @@ -12,7 +12,7 @@ class UserBid extends Resource 'id' => $this->id, 'user_id' => $this->user_id, 'flight_id' => $this->flight_id, - 'flight' => Flight::collection($this->whenLoaded('flight')) + 'flights' => Flight::collection($this->whenLoaded('flight')) #'created_at' => $this->created_at, #'updated_at' => $this->updated_at, ]; diff --git a/app/Models/Flight.php b/app/Models/Flight.php index 7f414c95..e508f8c2 100644 --- a/app/Models/Flight.php +++ b/app/Models/Flight.php @@ -112,14 +112,14 @@ class Flight extends Model $flight_id = $this->airline->code; $flight_id .= $this->flight_number; - if (filled($this->route_code)) { - $flight_id .= '/C'.$this->route_code; - } - if (filled($this->route_leg)) { $flight_id .= '/L'.$this->route_leg; } + if (filled($this->route_code)) { + $flight_id .= '/C'.$this->route_code; + } + return $flight_id; }