'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', ]; /** * Import a flight, parse out the different rows * @param array $row * @param int $index * @return bool */ public function import(array $row, $index): bool { $row['id'] = $row['icao']; $row['hub'] = get_truth_state($row['hub']); $airport = Airport::firstOrNew([ 'id' => $row['icao'] ], $row); try { $airport->save(); } catch (\Exception $e) { $this->errorLog('Error in row '.$index.': '.$e->getMessage()); return false; } $this->log('Imported '.$row['icao']); return true; } }