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.
2 parents 07a2500 + 0f7b816 commit 2745cd5Copy full SHA for 2745cd5
src/Middleware/AuthRoles.php
@@ -20,13 +20,15 @@ class AuthRoles
20
*/
21
public function handle($request, Closure $next)
22
{
23
+
24
+ $guard = auth('api')->check() ? 'api' : '';
25
- throw_if(!auth()->check(), UnauthenticatedException::notLoggedIn());
26
+ throw_if(!auth($guard)->check(), UnauthenticatedException::notLoggedIn());
27
28
$action = $request->route()->getActionname();
29
$name = $request->route()->getActionname();
30
- $role_id = auth()->user()->role_id;
31
+ $role_id = auth($guard)->user()->role_id;
32
33
$permission = Permission::where(function ($query)use ($action, $name){
34
$query->where('name', $name);
0 commit comments