Export extra fields for airports
This commit is contained in:
@@ -18,15 +18,19 @@ class AirportImporter extends ImportExport
|
|||||||
* Should match the database fields, for the most part
|
* Should match the database fields, for the most part
|
||||||
*/
|
*/
|
||||||
public static $columns = [
|
public static $columns = [
|
||||||
'icao' => 'required',
|
'icao' => 'required',
|
||||||
'iata' => 'required',
|
'iata' => 'required',
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'location' => 'nullable',
|
'location' => 'nullable',
|
||||||
'country' => 'nullable',
|
'country' => 'nullable',
|
||||||
'timezone' => 'nullable',
|
'timezone' => 'nullable',
|
||||||
'hub' => 'nullable|boolean',
|
'hub' => 'nullable|boolean',
|
||||||
'lat' => 'required|numeric',
|
'lat' => 'required|numeric',
|
||||||
'lon' => 'required|numeric',
|
'lon' => 'required|numeric',
|
||||||
|
'ground_handling_cost' => 'nullable|float',
|
||||||
|
'fuel_100ll_cost' => 'nullable|float',
|
||||||
|
'fuel_jeta_cost' => 'nullable|float',
|
||||||
|
'fuel_mogas_cost' => 'nullable|float',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,12 +45,12 @@ class AirportImporter extends ImportExport
|
|||||||
$row['hub'] = get_truth_state($row['hub']);
|
$row['hub'] = get_truth_state($row['hub']);
|
||||||
|
|
||||||
$airport = Airport::firstOrNew([
|
$airport = Airport::firstOrNew([
|
||||||
'id' => $row['icao']
|
'id' => $row['icao']
|
||||||
], $row);
|
], $row);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$airport->save();
|
$airport->save();
|
||||||
} catch(\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->errorLog('Error in row '.$index.': '.$e->getMessage());
|
$this->errorLog('Error in row '.$index.': '.$e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
icao,iata,name,location,country,timezone,hub,lat,lon
|
icao,iata,name,location,country,timezone,hub,lat,lon,ground_handling_cost,fuel_100ll_cost,fuel_jeta_cost,fuel_mogas_cost
|
||||||
KAUS,AUS,Austin-Bergstrom,"Austin, Texas, USA", United States,America/Chicago,1,30.1945,-97.6699
|
KAUS,AUS,Austin-Bergstrom,"Austin, Texas, USA", United States,America/Chicago,1,30.1945,-97.6699,,,,
|
||||||
KSFO,SFO,San Francisco,"San Francisco, California, USA", United States,America/California,"1",30.1945,-97.6699
|
KSFO,SFO,San Francisco,"San Francisco, California, USA", United States,America/California,"1",30.1945,-97.6699,,,,
|
||||||
KJFK,JFK,Kennedy,"Queens, New York, USA", United States,America/New_York,0,30.1945,abcd
|
KJFK,JFK,Kennedy,"Queens, New York, USA", United States,America/New_York,0,30.1945,abcd,,,,
|
||||||
|
|||||||
|
Reference in New Issue
Block a user