diff --git a/app/Database/migrations/2017_06_23_011011_create_subfleet_tables.php b/app/Database/migrations/2017_06_23_011011_create_subfleet_tables.php index 194e18a3..10a48330 100644 --- a/app/Database/migrations/2017_06_23_011011_create_subfleet_tables.php +++ b/app/Database/migrations/2017_06_23_011011_create_subfleet_tables.php @@ -19,6 +19,7 @@ class CreateSubfleetTables extends Migration $table->string('name', 50); $table->string('type', 50); $table->unsignedTinyInteger('fuel_type')->nullable(); + $table->unsignedDecimal('ground_handling_multiplier')->nullable()->default(100); $table->unsignedDecimal('cargo_capacity')->nullable(); $table->unsignedDecimal('fuel_capacity')->nullable(); $table->unsignedDecimal('gross_weight')->nullable(); diff --git a/app/Database/seeds/sample.yml b/app/Database/seeds/sample.yml index 6ada63f9..1ae98427 100644 --- a/app/Database/seeds/sample.yml +++ b/app/Database/seeds/sample.yml @@ -183,10 +183,12 @@ subfleets: airline_id: 1 name: 747-400 Winglets type: 744W + ground_handling_multiplier: 200 - id: 2 airline_id: 1 name: 777-200 LR type: 772-LR + ground_handling_multiplier: 150 # add a few mods to aircraft and fares subfleet_fare: @@ -248,8 +250,8 @@ flights: flight_number: 6028 route_code: A route_leg: 1 - dpt_airport_id: KIAH - arr_airport_id: KAUS + dpt_airport_id: EGLL + arr_airport_id: KJFK dpt_time: 9AM CST arr_time: 1030AM CST route: PITZZ4 MNURE WLEEE4 diff --git a/app/Models/Subfleet.php b/app/Models/Subfleet.php index d5348b77..616095ad 100644 --- a/app/Models/Subfleet.php +++ b/app/Models/Subfleet.php @@ -9,13 +9,13 @@ namespace App\Models; class Subfleet extends BaseModel { public $table = 'subfleets'; - protected $dates = ['deleted_at']; public $fillable = [ 'airline_id', 'name', 'type', 'fuel_type', + 'ground_handling_multiplier', 'cargo_capacity', 'fuel_capacity', 'gross_weight', @@ -27,16 +27,18 @@ class Subfleet extends BaseModel * @var array */ protected $casts = [ - 'airline_id' => 'integer', - 'fuel_type' => 'integer', - 'cargo_capacity' => 'double', - 'fuel_capacity' => 'double', - 'gross_weight' => 'double', + 'airline_id' => 'integer', + 'fuel_type' => 'integer', + 'ground_handling_multiplier' => 'float', + 'cargo_capacity' => 'float', + 'fuel_capacity' => 'float', + 'gross_weight' => 'float', ]; public static $rules = [ - 'name' => 'required', - 'type' => 'required', + 'name' => 'required', + 'type' => 'required', + 'ground_handling_multiplier' => 'nullable|numeric', ]; /** @@ -51,6 +53,10 @@ class Subfleet extends BaseModel if (filled($model->type)) { $model->type = str_replace(' ', '_', $model->type); } + + if(!filled($model->ground_handling_multiplier)) { + $model->ground_handling_multiplier = 100; + } }); static::updating(function ($model) { diff --git a/resources/views/admin/subfleets/fields.blade.php b/resources/views/admin/subfleets/fields.blade.php index daa844de..1e861415 100644 --- a/resources/views/admin/subfleets/fields.blade.php +++ b/resources/views/admin/subfleets/fields.blade.php @@ -11,19 +11,35 @@ {!! Form::text('type', null, ['class' => 'form-control']) !!}
{{ $errors->first('type') }}
+ +{{ $errors->first('airline_id') }}
{{ $errors->first('fuel_type') }}
{{ $errors->first('ground_handling_multiplier') }}
+