We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
getUserId
1 parent 19eee0a commit 75dcab5Copy full SHA for 75dcab5
src/Utills/UserUtils.php
@@ -47,4 +47,20 @@ public static function getCurrentGuardName(): ?string
47
48
return null;
49
}
50
+
51
+ /**
52
+ * Get the user id by guards.
53
+ */
54
+ public static function getUserId(): ?int
55
+ {
56
+ $guards = config('user-monitoring.user.guard', ['web']);
57
58
+ foreach ($guards as $guard) {
59
+ if (Auth::guard($guard)->check()) {
60
+ return Auth::guard($guard)->id();
61
+ }
62
63
64
+ return null;
65
66
0 commit comments