/** * Execute the console command. * * @return mixed */ public function fire() { // Clean unsent responses older than 30 minutes, since the client likely exited the page. $unsent_min = \Carbon\Carbon::now()->subMinutes(30); QueryResponse::unsent()->where('created_at', '<', $unsent_min)->delete(); // Check the archive if (Config::get('lowendping.archive.enabled', false)) { $mintime = \Carbon\Carbon::now()->subDays(Config::get('lowendping.archive.days')); $queries = Query::where('created_at', '<', $mintime)->get(); foreach ($queries as $query) { $this->info('Deleting query ' . $query->id); QueryResponse::where('query_id', $query->id)->delete(); $query->delete(); } } }