コード例 #1
0
 /**
  * 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());
     }
 }
コード例 #2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     RouteUsage::create(['path' => $request->path(), 'method' => $request->method()]);
     return $next($request);
 }