Add a ground_handling_multiplier to the subfleet table #134
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user