Update authenticate
This commit is contained in:
@@ -21,21 +21,21 @@ class Authenticate extends Middleware
|
||||
}
|
||||
}
|
||||
|
||||
public function handle($request, Closure $next, ...$guards)
|
||||
{
|
||||
// Kalau tidak ada guard dikirim dari route
|
||||
if (empty($guards)) {
|
||||
$guards = [null];
|
||||
}
|
||||
// public function handle($request, Closure $next, ...$guards)
|
||||
// {
|
||||
// // Kalau tidak ada guard dikirim dari route
|
||||
// if (empty($guards)) {
|
||||
// $guards = [null];
|
||||
// }
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
// foreach ($guards as $guard) {
|
||||
// if (Auth::guard($guard)->check()) {
|
||||
// return $next($request);
|
||||
// }
|
||||
// }
|
||||
|
||||
return response()->json([
|
||||
'error' => 'Unauthorized'
|
||||
], 401);
|
||||
}
|
||||
// return response()->json([
|
||||
// 'error' => 'Unauthorized'
|
||||
// ], 401);
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user