Add ground_handling_cost to airport #134

This commit is contained in:
Nabeel Shahzad
2018-02-23 15:48:50 -06:00
parent b8b4fe7a8a
commit 4142d5d28a
6 changed files with 60 additions and 74 deletions

View File

@@ -25,8 +25,9 @@ $factory->define(App\Models\Airport::class, function (Faker $faker) {
'timezone' => $faker->timezone,
'lat' => $faker->latitude,
'lon' => $faker->longitude,
'fuel_100ll_cost' => $faker->randomFloat(2),
'fuel_jeta_cost' => $faker->randomFloat(2),
'fuel_mogas_cost' => $faker->randomFloat(2),
'ground_handling_cost' => $faker->randomFloat(2, 0, 500),
'fuel_100ll_cost' => $faker->randomFloat(2, 0, 100),
'fuel_jeta_cost' => $faker->randomFloat(2, 0, 100),
'fuel_mogas_cost' => $faker->randomFloat(2, 0, 100),
];
});

View File

@@ -16,6 +16,7 @@ class CreateAirportsTable extends Migration
$table->string('country', 64)->nullable();
$table->string('timezone', 64)->nullable();
$table->boolean('hub')->default(false);
$table->unsignedDecimal('ground_handling_cost')->nullable()->default(0);
$table->unsignedDecimal('fuel_100ll_cost')->nullable()->default(0);
$table->unsignedDecimal('fuel_jeta_cost')->nullable()->default(0);
$table->unsignedDecimal('fuel_mogas_cost')->nullable()->default(0);

View File

@@ -115,6 +115,7 @@ airports:
lat: 30.1945278
lon: -97.6698889
hub: 1
ground_handling_cost: 100
- id: KJFK
iata: JFK
icao: KJFK
@@ -125,51 +126,7 @@ airports:
lat: 40.6399257
lon: -73.7786950
hub: 1
- id: KBWI
iata: BWI
icao: KBWI
name: Baltimore/Washington International Thurgood Marshall Airport
location: Baltimore, MD
country: United States
timezone: America/New_York
lat: 39.1754
lon: -76.6683
- id: KIAH
iata: IAH
icao: KIAH
name: George Bush Intercontinental Houston Airport
location: Houston, TX
country: United States
timezone: America/Chicago
lat: 29.9844
lon: -95.3414
- id: KORD
iata: ORD
icao: KORD
name: Chicago O'Hare International Airport
location: Chicago, IL
country: United States
timezone: America/Chicago
lat: 41.9786
lon: -87.9048
- id: KDFW
iata: DFW
icao: KDFW
name: Dallas Fort Worth International Airport
location: Dallas, TX
country: United States
timezone: America/Chicago
lat: 32.8968
lon: -97.038
- id: EFHK
iata: HEL
icao: EFHK
name: Helsinki Vantaa Airport
location: Helsinki
country: Finland
timezone: Europe/Helsinki
lat: 60.3172
lon: 24.9633
ground_handling_cost: 250
- id: EGLL
iata: LHR
icao: EGLL
@@ -178,6 +135,7 @@ airports:
timezone: Europe/London
lat: 51.4775
lon: -0.4614
ground_handling_cost: 500
- id: LGRP
iata: RHO
icao: LGRP
@@ -187,6 +145,7 @@ airports:
timezone: Europe/Athens
lat: 36.4054
lon: 28.0862
ground_handling_cost: 50
#
aircraft:
- id: 1

View File

@@ -27,6 +27,7 @@ class Airport extends BaseModel
'lon',
'hub',
'timezone',
'ground_handling_cost',
'fuel_100ll_cost',
'fuel_jeta_cost',
'fuel_mogas_cost',
@@ -36,6 +37,7 @@ class Airport extends BaseModel
'lat' => 'float',
'lon' => 'float',
'hub' => 'boolean',
'ground_handling_cost' => 'float',
'fuel_100ll_cost' => 'float',
'fuel_jeta_cost' => 'float',
'fuel_mogas_cost' => 'float',
@@ -45,12 +47,13 @@ class Airport extends BaseModel
* Validation rules
*/
public static $rules = [
'icao' => 'required',
'iata' => 'nullable',
'name' => 'required',
'location' => 'nullable',
'lat' => 'required|numeric',
'lon' => 'required|numeric',
'icao' => 'required',
'iata' => 'nullable',
'name' => 'required',
'location' => 'nullable',
'lat' => 'required|numeric',
'lon' => 'required|numeric',
'ground_handling_cost' => 'nullable|numeric',
];
/**