Laravel Route Statistics — это пакет, созданный @bilfeldt для регистрации статистики об использовании маршрутов пользователями и командами в приложении Laravel. Этот пакет позволяет:
- See how much each user uses the application and what part of the application they use
- See if any unauthenticated users are making a lot of requests to your application
Используя промежуточное ПО Laravel, пакет позволяет включить ведение журнала маршрутов глобально, или вы можете включить его для отдельных групп маршрутов и маршрутов через промежуточное ПО:
Route::middleware(['routestatistics'])
->get('/example', /* ... */);
Наконец, вы даже можете включить ведение журнала через макрос запроса:
public function index(Request $request)
{
$request->routeStatistics();
// ...
return view('example');
}
Этот пакет регистрирует запросы к базе данных со следующими полями по умолчанию:
-
user_id
- the user id if authenticated -
team_id
- the team id associated with the request (if available) -
method
- the HTTP method -
route
- the route name (if available) or the route URI -
status
- the HTTP status code -
ip
- the request IP -
date
- the date of the request stored as a datetime