authenticate($guards); return $next($request); } /** * Determine if the user is logged in to any of the given guards. * * @param array $guards * @return void * * @throws \Illuminate\Auth\AuthenticationException */ protected function authenticate(array $guards) { if (count($guards) <= 1) { Auth::guard(array_first($guards))->authenticate(); return Auth::shouldUse($guard); } foreach ($guards as $guard) { if (Auth::guard($guard)->check()) { return Auth::shouldUse($guard); } } throw new AuthenticationException; } }