diff --git a/src/Models/RequestLog.php b/src/Models/RequestLog.php index 7e73c02..bf810cc 100644 --- a/src/Models/RequestLog.php +++ b/src/Models/RequestLog.php @@ -102,7 +102,7 @@ public function log(Request $request, $response, ?int $duration = null, ?int $me $model->session = $request->hasSession() ? $request->session()->getId() : null; $model->middleware = array_values(optional($request->route())->gatherMiddleware() ?? []); $model->method = $request->getMethod(); - $model->route = $request->route()->getName(); + $model->route = optional($request->route())->getName() ?? optional($request->route())->uri(); // Note that $request->route()->uri() does not replace the placeholders while $request->getRequestUri() replaces the placeholders $model->path = $request->path(); $model->status = $response->getStatusCode(); $model->headers = $this->getFiltered($request->headers->all()) ?: null;