From 87b5ad390f7b99d3dc273e98c1cfa855b620dd57 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sun, 4 Feb 2018 12:39:51 -0600 Subject: [PATCH] Make sure all the Flight fields are included --- app/Http/Resources/Flight.php | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/app/Http/Resources/Flight.php b/app/Http/Resources/Flight.php index 420124a1..c9ef20ab 100644 --- a/app/Http/Resources/Flight.php +++ b/app/Http/Resources/Flight.php @@ -8,25 +8,11 @@ class Flight extends Resource { public function toArray($request) { - return [ - 'id' => $this->id, - 'airline' => $this->airline, - 'flight_number' => $this->flight_number, - 'route_code' => $this->route_code, - 'route_leg' => $this->route_leg, - 'dpt_airport_id' => $this->dpt_airport_id, - 'arr_airport_id' => $this->arr_airport_id, - 'alt_airport_id' => $this->alt_airport_id, - 'route' => $this->route, - 'dpt_time' => $this->dpt_time, - 'arr_time' => $this->arr_time, - 'flight_time' => $this->flight_time, - 'notes' => $this->notes, - 'active' => $this->active, + $flight = parent::toArray($request); - 'subfleet' => Subfleet::collection($this->subfleets), - #'created_at' => $this->created_at, - #'updated_at' => $this->updated_at, - ]; + $flight['airline'] = new Airline($this->airline); + $flight['subfleet'] = Subfleet::collection($this->subfleets); + + return $flight; } }