/** * Execute the console command. * * @return mixed */ public function handle() { if ($this->option('count')) { $report = RouteUsage::select(DB::raw('count(*) as used, path'))->groupBy('path')->orderBy('used', 'DESC')->get()->toArray(); $this->table($this->headers_count, $report); } elseif ($this->option('clean')) { if ($this->confirm("Are you Sure?")) { DB::table('route_usages')->truncate(); } } else { $report = RouteUsage::select('path', 'method', 'created_at')->orderBy('created_at', "DESC")->get(); $this->table($this->headers, $report->toArray()); } }