Properly create/update rows importing #486 (#503)

This commit is contained in:
Nabeel S
2020-01-16 10:40:42 -05:00
committed by GitHub
parent fa01c61677
commit c2f7c5e421
8 changed files with 40 additions and 33 deletions

View File

@@ -45,12 +45,10 @@ class AirportImporter extends ImportExport
$row['id'] = $row['icao'];
$row['hub'] = get_truth_state($row['hub']);
$airport = Airport::firstOrNew([
'id' => $row['icao'],
], $row);
try {
$airport->save();
$airport = Airport::updateOrCreate([
'id' => $row['icao'],
], $row);
} catch (\Exception $e) {
$this->errorLog('Error in row '.$index.': '.$e->getMessage());
return false;