Skip to content

Commit 2818b65

Browse files
committed
chore: fix raw route
1 parent eb3a048 commit 2818b65

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

app/Audit/AuditEventListener.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,17 @@ private function buildAuditContext(): AuditContext
9999
//$ui = app()->bound('ui.context') ? app('ui.context') : [];
100100

101101
$req = request();
102-
103-
$route = Route::getRoutes()->match($req);
104-
$method = $route->methods[0] ?? 'UNKNOWN';
105-
$rawRoute = $method . self::ROUTE_METHOD_SEPARATOR . $route->uri;
106-
102+
103+
try {
104+
$route = Route::getRoutes()->match($req);
105+
$method = $route->methods[0] ?? 'UNKNOWN';
106+
$rawRoute = $method . self::ROUTE_METHOD_SEPARATOR . $route->uri;
107+
}
108+
catch (\Exception $e) {
109+
Log::warning($e);
110+
$rawRoute = null;
111+
}
112+
107113
return new AuditContext(
108114
userId: $member?->getId(),
109115
userEmail: $member?->getEmail(),

0 commit comments

Comments
 (0)