getAirline($row['airline']); if(!$airline) { $this->status = 'Airline '.$row['airline'].' not found, row: '.$index; return false; } $row['airline_id'] = $airline->id; $subfleet = Subfleet::firstOrNew([ 'type' => $row['type'] ], $row); try { $subfleet->save(); } catch(\Exception $e) { $this->status = 'Error in row '.$index.': '.$e->getMessage(); return false; } $this->status = 'Imported ' . $row['type']; return true; } }