where('banned', false) ->orderBy('created_at') ->chunk(10000, function ($logs) use (&$good, &$bad) { foreach ($logs as $line) { try { $line->evaluate(); $line->evaluated_at = now(); $line->save(); ++$good; } catch (\Exception $e) { ++$bad; $this->error('unable to evaluate line '.$line->id.': '.$e->getMessage()); $line->type = 'error'; $line->text_content = $e->getMessage(); $line->evaluated_at = now(); $line->save(); } } echo $good; if ($bad) { echo ' +', $bad, ' errors'; } echo PHP_EOL; }); return Command::SUCCESS; } }