From 9a426f79f9cd125330510f6b6f1b6f0eca7679cf Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Tue, 30 Jan 2018 11:27:39 -0600 Subject: [PATCH] Add fuel_used column to PIREPs table --- app/Database/factories/PirepFactory.php | 1 + .../migrations/2017_06_28_195426_create_pirep_tables.php | 1 + app/Http/Requests/Acars/FileRequest.php | 1 + app/Models/Pirep.php | 2 ++ 4 files changed, 5 insertions(+) diff --git a/app/Database/factories/PirepFactory.php b/app/Database/factories/PirepFactory.php index 2759fdf1..17a79330 100644 --- a/app/Database/factories/PirepFactory.php +++ b/app/Database/factories/PirepFactory.php @@ -43,6 +43,7 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) { 'planned_flight_time' => $faker->randomFloat(2), 'zfw' => $faker->randomFloat(2), 'block_fuel' => $faker->randomFloat(2), + 'fuel_used' => $faker->randomFloat(2), 'route' => $faker->text(200), 'notes' => $faker->text(200), 'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]), diff --git a/app/Database/migrations/2017_06_28_195426_create_pirep_tables.php b/app/Database/migrations/2017_06_28_195426_create_pirep_tables.php index d63098bb..a5bce79e 100644 --- a/app/Database/migrations/2017_06_28_195426_create_pirep_tables.php +++ b/app/Database/migrations/2017_06_28_195426_create_pirep_tables.php @@ -35,6 +35,7 @@ class CreatePirepTables extends Migration $table->unsignedDecimal('planned_flight_time', 19)->nullable(); $table->unsignedDecimal('zfw', 19)->nullable(); $table->unsignedDecimal('block_fuel', 19)->nullable(); + $table->unsignedDecimal('fuel_used', 19)->nullable(); $table->decimal('landing_rate', 19)->nullable(); $table->text('route')->nullable(); $table->text('notes')->nullable(); diff --git a/app/Http/Requests/Acars/FileRequest.php b/app/Http/Requests/Acars/FileRequest.php index 44b6687c..6dad0efe 100644 --- a/app/Http/Requests/Acars/FileRequest.php +++ b/app/Http/Requests/Acars/FileRequest.php @@ -22,6 +22,7 @@ class FileRequest extends FormRequest { $rules = [ 'flight_time' => 'required|integer', + 'fuel_used' => 'required|numeric', 'airline_id' => 'nullable|exists:airlines,id', 'aircraft_id' => 'nullable|exists:aircraft,id', diff --git a/app/Models/Pirep.php b/app/Models/Pirep.php index 012c8b64..2348ec7d 100644 --- a/app/Models/Pirep.php +++ b/app/Models/Pirep.php @@ -36,6 +36,7 @@ class Pirep extends BaseModel 'planned_flight_time', 'zfw', 'block_fuel', + 'fuel_used', 'landing_rate', 'route', 'notes', @@ -60,6 +61,7 @@ class Pirep extends BaseModel 'planned_flight_time' => 'integer', 'zfw' => 'float', 'block_fuel' => 'float', + 'fuel_used' => 'float', 'landing_rate' => 'float', 'source' => 'integer', 'flight_type' => 'integer',