| Conditions | 2 |
| Paths | 2 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function index() |
||
| 14 | { |
||
| 15 | $latestRequests = LarametricsRequest::orderBy('created_at', 'desc') |
||
| 16 | ->limit(200) |
||
| 17 | ->get(); |
||
| 18 | |||
| 19 | $requests = LarametricsRequest::all() |
||
| 20 | ->toArray(); |
||
| 21 | foreach($requests as $index => $request) { |
||
| 22 | $responseTime = floor(($request['end_time'] - $request['start_time']) * 1000); |
||
| 23 | $requests[$index]['responseTime'] = $responseTime; |
||
| 24 | } |
||
| 25 | |||
| 26 | usort( |
||
| 27 | $requests, function ($a, $b) { |
||
| 28 | return $b['responseTime'] - $a['responseTime']; |
||
| 29 | } |
||
| 30 | ); |
||
| 31 | |||
| 32 | return view( |
||
| 33 | 'rica.larametrics::performance.index', [ |
||
| 34 | 'latestRequests' => $latestRequests, |
||
| 35 | 'requestsByResponseTime' => array_slice($requests, 0, 10), |
||
| 36 | 'pageTitle' => 'App Performance' |
||
| 37 | ] |
||
| 38 | ); |
||
| 39 | } |
||
| 40 | |||
| 42 |