/** * Execute the console command. * * @return mixed */ public function fire() { try { $log = new Process(); $log->name = "get-links"; $log->status = "running"; $log->save(); //Check new links Rss::chunk(100, function ($rss) { foreach ($rss as $value) { $this->loadRss($value); $value->touch(); } }); //Remove old links $filterDate = new DateTime('now'); $filterDate->sub(new DateInterval('P1D')); Link::where('date', '<', $filterDate)->where('updated_at', '<', $filterDate)->delete(); $log->status = "finished"; $log->save(); } catch (Exception $e) { $this->info($url); $this->info($e->getMessage()); } }