= 0) { $httpLog = $httpLog->where('created_at', '>=', Carbon::today() ->subDays($pastDays)); } session(['profilerPastDays' => $pastDays]); if (Input::get('method')) { $filters[] = 'method'; $httpLog = $httpLog->where('method', Input::get('method')); } $displayGrouped = false; if (Input::get('url')) { $httpLog = $httpLog->where('url', Input::get('url')) ->orderBy('created_at', 'DESC') ->with('queries'); } else { $displayGrouped = true; $httpLog = $httpLog->groupBy('url', 'method') ->select(\DB::raw('*'), \DB::raw('COUNT(url) as total'), \DB::raw('AVG(time) as time_avg')) ->orderBy('total', 'DESC'); } $httpLog = $httpLog->paginate(25); $filter = Input::all(); return view('profiler::index', compact('httpLog', 'displayGrouped', 'filter', 'pastDays')); } public function destroy() { $older = Input::get('olderThan'); if (is_null($older)) { \DB::statement("SET foreign_key_checks=0"); QueryLog::truncate(); HttpLog::truncate(); \DB::statement("SET foreign_key_checks=1"); } else { HttpLog::where('created_at', '<=', Carbon::now() ->subDays($older)) ->delete(); } return redirect() ->back() ->with('success', trans('profiler::module.succesfullyDeleted')); } }