Skip to content

Commit c0601bb

Browse files
committed
fix getUserId method
1 parent 8751a2e commit c0601bb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Utills/UserUtils.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@ public static function getCurrentGuardName(): ?string
5353
*/
5454
public static function getUserId(): ?int
5555
{
56-
$guards = config('user-monitoring.user.guard', ['web']);
56+
$guards = config('user-monitoring.user.guards', ['web']);
5757

5858
foreach ($guards as $guard) {
59-
if (Auth::guard($guard)->check()) {
60-
return Auth::guard($guard)->id();
61-
}
59+
try {
60+
if (Auth::guard($guard)->check()) {
61+
return Auth::guard($guard)->id();
62+
}
63+
} catch (\Exception $e) {}
6264
}
6365

6466
return null;

0 commit comments

Comments
 (0)