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