diff --git a/app/Services/ImportExport/AirportImporter.php b/app/Services/ImportExport/AirportImporter.php index d0ad25a4..3723ddab 100644 --- a/app/Services/ImportExport/AirportImporter.php +++ b/app/Services/ImportExport/AirportImporter.php @@ -18,15 +18,19 @@ class AirportImporter extends ImportExport * Should match the database fields, for the most part */ public static $columns = [ - 'icao' => 'required', - 'iata' => 'required', - 'name' => 'required', - 'location' => 'nullable', - 'country' => 'nullable', - 'timezone' => 'nullable', - 'hub' => 'nullable|boolean', - 'lat' => 'required|numeric', - 'lon' => 'required|numeric', + 'icao' => 'required', + 'iata' => 'required', + 'name' => 'required', + 'location' => 'nullable', + 'country' => 'nullable', + 'timezone' => 'nullable', + 'hub' => 'nullable|boolean', + 'lat' => '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']); $airport = Airport::firstOrNew([ - 'id' => $row['icao'] + 'id' => $row['icao'] ], $row); try { $airport->save(); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->errorLog('Error in row '.$index.': '.$e->getMessage()); return false; } diff --git a/tests/data/airports.csv b/tests/data/airports.csv index 0a279223..72a31c72 100644 --- a/tests/data/airports.csv +++ b/tests/data/airports.csv @@ -1,4 +1,4 @@ -icao,iata,name,location,country,timezone,hub,lat,lon -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 -KJFK,JFK,Kennedy,"Queens, New York, USA", United States,America/New_York,0,30.1945,abcd +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,,,, +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,,,,