INIT: initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Profiler\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Modules\Profiler\Entities\HttpLog;
|
||||
|
||||
class RequestController extends Controller
|
||||
{
|
||||
public function detail(HttpLog $httpLog)
|
||||
{
|
||||
$sameRequests = HttpLog::where('url', $httpLog->url)
|
||||
->where('method', $httpLog->method);
|
||||
|
||||
$pastDays = Input::get('pastDays', session('profilerPastDays', 0));
|
||||
if (is_numeric($pastDays) && $pastDays >= 0) {
|
||||
$sameRequests = $sameRequests->where('created_at', '>=', Carbon::today()
|
||||
->subDays($pastDays));
|
||||
}
|
||||
|
||||
session(['profilerPastDays' => $pastDays]);
|
||||
|
||||
$sameRequests = $sameRequests->get();
|
||||
|
||||
$times = [
|
||||
'avg' => $sameRequests->avg('time'),
|
||||
'min' => $sameRequests->min('time'),
|
||||
'max' => $sameRequests->max('time')
|
||||
];
|
||||
|
||||
$filter = Input::all();
|
||||
|
||||
return view('profiler::request.detail', compact('httpLog', 'sameRequests', 'times', 'pastDays', 'filter'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user