Skip to content

Commit

Permalink
Merge pull request #25 from julienbourdeau/feat/support-dingo-router
Browse files Browse the repository at this point in the history
Log access if request->route() is not defined (fix #22)
  • Loading branch information
julienbourdeau committed Jul 17, 2021
2 parents f25d54c + d083858 commit 0ae6c26
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Listeners/LogRouteUsage.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ protected function shouldLogUsage($event)
$route = $event->request->route();
$regex = config('route-usage.excluding-regex');

// $route is not set when using Dingo router
// See https://github.com/julienbourdeau/route-usage/issues/22
if (is_null($route)) {
return true;
}

if (isset($regex['name']) && $regex['name'] && preg_match($regex['name'], $route->getName())) {
return false;
}
Expand Down

0 comments on commit 0ae6c26

Please sign in to comment.