comment('--- RANK IMPORT ---'); $count = 0; $rows = $this->db->readRows($this->table, $this->idField, $start); foreach ($rows as $row) { $rank = Rank::firstOrCreate(['name' => $row->rank], [ 'image_url' => $row->rankimage, 'hours' => $row->minhours, 'acars_base_payrate' => $row->payrate, 'manual_base_payrate' => $row->payrate, ]); $this->idMapper->addMapping('ranks', $row->rankid, $rank->id); $this->idMapper->addMapping('ranks', $row->rank, $rank->id); if ($rank->wasRecentlyCreated) { $count++; } } $this->info('Imported '.$count.' ranks'); } }