Skip to content

Commit 68cc7c6

Browse files
authored
Merge pull request #15 from woenel/patch-1
Fix: Call to a member function getName() on null Thanks @woenel well spotted 👍
2 parents ee20c77 + f0f1e94 commit 68cc7c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Models/RequestLog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function log(Request $request, $response, ?int $duration = null, ?int $me
102102
$model->session = $request->hasSession() ? $request->session()->getId() : null;
103103
$model->middleware = array_values(optional($request->route())->gatherMiddleware() ?? []);
104104
$model->method = $request->getMethod();
105-
$model->route = $request->route()->getName();
105+
$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
106106
$model->path = $request->path();
107107
$model->status = $response->getStatusCode();
108108
$model->headers = $this->getFiltered($request->headers->all()) ?: null;

0 commit comments

Comments
 (0)