From 73ffc9cf448659ac986617d5b4cfc9b91fa4175c Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Mon, 30 Apr 2018 17:29:42 -0500 Subject: [PATCH] Fix flight type parameter --- app/Http/Controllers/Api/PirepController.php | 5 +++++ app/Http/Requests/Acars/FileRequest.php | 2 +- app/Http/Requests/Acars/PrefileRequest.php | 2 +- app/Http/Requests/Acars/UpdateRequest.php | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/PirepController.php b/app/Http/Controllers/Api/PirepController.php index d610ff19..4be491b5 100644 --- a/app/Http/Controllers/Api/PirepController.php +++ b/app/Http/Controllers/Api/PirepController.php @@ -209,6 +209,11 @@ class PirepController extends Controller $this->checkCancelled($pirep); } + // Default to a scheduled passenger flight + if(!array_key_exists('flight_type', $attrs)) { + $attrs['flight_type'] = 'J'; + } + $pirep->save(); Log::info('PIREP PREFILED'); diff --git a/app/Http/Requests/Acars/FileRequest.php b/app/Http/Requests/Acars/FileRequest.php index 9c7ddd6b..c4dbdc05 100644 --- a/app/Http/Requests/Acars/FileRequest.php +++ b/app/Http/Requests/Acars/FileRequest.php @@ -30,6 +30,7 @@ class FileRequest extends FormRequest 'airline_id' => 'nullable|exists:airlines,id', 'aircraft_id' => 'nullable|exists:aircraft,id', 'flight_number' => 'nullable', + 'flight_type' => 'nullable', 'dpt_airport_id' => 'nullable', 'arr_airport_id' => 'nullable', 'route_code' => 'nullable', @@ -44,7 +45,6 @@ class FileRequest extends FormRequest 'source_name' => 'nullable', 'score' => 'nullable|integer', 'landing_rate' => 'nullable|numeric', - 'flight_type' => 'nullable|integer', 'block_off_time' => 'nullable|date', 'block_on_time' => 'nullable|date', 'created_at' => 'nullable|date', diff --git a/app/Http/Requests/Acars/PrefileRequest.php b/app/Http/Requests/Acars/PrefileRequest.php index 609059aa..2dce7e14 100644 --- a/app/Http/Requests/Acars/PrefileRequest.php +++ b/app/Http/Requests/Acars/PrefileRequest.php @@ -26,6 +26,7 @@ class PrefileRequest extends FormRequest 'source_name' => 'required', 'level' => 'nullable|numeric', + 'flight_type' => 'nullable', 'route_code' => 'nullable', 'route_leg' => 'nullable', 'distance' => 'nullable|numeric', @@ -38,7 +39,6 @@ class PrefileRequest extends FormRequest 'route' => 'nullable', 'notes' => 'nullable', 'score' => 'nullable|integer', - 'flight_type' => 'nullable|integer', 'block_off_time' => 'nullable|date', 'block_on_time' => 'nullable|date', 'created_at' => 'nullable|date', diff --git a/app/Http/Requests/Acars/UpdateRequest.php b/app/Http/Requests/Acars/UpdateRequest.php index c0c563e7..2941c3d1 100644 --- a/app/Http/Requests/Acars/UpdateRequest.php +++ b/app/Http/Requests/Acars/UpdateRequest.php @@ -33,6 +33,7 @@ class UpdateRequest extends FormRequest 'planned_distance' => 'nullable|numeric', 'block_time' => 'nullable|integer', 'flight_time' => 'nullable|integer', + 'flight_type' => 'nullable', 'planned_flight_time' => 'nullable|integer', 'level' => 'nullable|numeric', 'zfw' => 'nullable|numeric', @@ -42,7 +43,6 @@ class UpdateRequest extends FormRequest 'notes' => 'nullable', 'source_name' => 'nullable|max:25', 'landing_rate' => 'nullable|numeric', - 'flight_type' => 'nullable|integer', 'block_off_time' => 'nullable|date', 'block_on_time' => 'nullable|date', 'created_at' => 'nullable|date',