FEATURE #2389 @2h: add request detail into profiler
This commit is contained in:
@@ -1,15 +1,28 @@
|
||||
<?php namespace Modules\Profiler\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Modules\Profiler\Entities\HttpLog;
|
||||
|
||||
class ProfilerController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$filters = [];
|
||||
$httpLog = HttpLog::orderBy('created_at', 'DESC')
|
||||
->with('queries')
|
||||
->paginate(25);
|
||||
->with('queries');
|
||||
|
||||
if (Input::get('method')) {
|
||||
$filters[] = 'method';
|
||||
$httpLog = $httpLog->where('method', Input::get('method'));
|
||||
}
|
||||
|
||||
if (Input::get('url')) {
|
||||
$filters[] = 'url';
|
||||
$httpLog = $httpLog->where('url', Input::get('url'));
|
||||
}
|
||||
|
||||
$httpLog = $httpLog->paginate(25);
|
||||
|
||||
return view('profiler::index', compact('httpLog'));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace Modules\Profiler\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use Modules\Profiler\Entities\HttpLog;
|
||||
|
||||
class RequestController extends Controller
|
||||
{
|
||||
public function detail(HttpLog $httpLog)
|
||||
{
|
||||
$sameRequests = HttpLog::where('url', $httpLog->url)
|
||||
->where('method', $httpLog->method)
|
||||
->get();
|
||||
|
||||
$times = [
|
||||
'avg' => $sameRequests->avg('time'),
|
||||
'min' => $sameRequests->min('time'),
|
||||
'max' => $sameRequests->max('time')
|
||||
];
|
||||
|
||||
return view('profiler::request.detail', compact('httpLog', 'sameRequests', 'times'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user