Skip to content

Commit

Permalink
Merge pull request #15 from woenel/patch-1
Browse files Browse the repository at this point in the history
Fix: Call to a member function getName() on null

Thanks @woenel well spotted 👍
  • Loading branch information
bilfeldt authored Nov 15, 2021
2 parents ee20c77 + f0f1e94 commit 68cc7c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Models/RequestLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 68cc7c6

Please sign in to comment.