@param string $scene
@param array  $guard

@return HasSceneGuard
166382
public function setSceneGuard(string $scene, array $guard): self
    {
        $this->scenes[$scene] = $guard;

        return $this;
    }
448133
private function identify($image, int $scene)
    {
        $image = self::encode($image);

        return Request::exec(self::IDENTIFY, compact('image', 'scene'));
    }
264581
protected function hasCredentials(array $credentials, $guard = null)
    {
        $provider = $this->app->make('auth')->guard($guard)->getProvider();

        $user = $provider->retrieveByCredentials($credentials);

        return $user && $provider->validateCredentials($user, $credentials);
    }
1105160
private function collectGuards($guards)
    {
        $this->collectedGuards = [];

        foreach ($guards as $type => $rules) {
            $this->collectedGuards[$type] = $rules;
        }
    }
708997
public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check()) {
            return response()->json(['error' => 'Already authenticated.'], 400);
        }

        return $next($request);
    }
1179659
public static function findByName(string $name, $guardName = null): RoleContract
    {
        $guardName = $guardName ?? Guard::getDefaultName(static::class);

        $role = static::where('name', $name)->where('guard_name', $guardName)->first();

        if (! $role) {
            throw RoleDoesNotExist::named($name);
        }

        return $role;
    }
1159509
public function handle($request, Closure $next, $guard = null, $field = null)
    {
        if (!App::environment(config('auth.environments', ['staging']))) {
            return $next($request);
        }

        return parent::handle($request, $next, $guard);
    }
911540
public function resolveGuard( $name )
	{
		$config = Config::get( 'auth.guards.' . $name );

		if ( is_null( $config ) )
			throw new AccountException( "Auth guard [" . $name . "] is not defined in the configuration" );

		$uses = $config['uses'];
		$auth = $this->resolveAuth( $config['auth'] ?: $this->getDefaultAuth() );

		$guard = null;
		switch ( $uses )
		{
			case 'session':
			{
				$guard = new SessionGuard( $name, $auth, SessionManager::i()->driver(), Request::i(), CookieJar::i() );
				break;
			}
			case 'token':
			{
				$guard = new TokenGuard( $auth, Request::i() );
				break;
			}
			default:
			{
				$guard = UniversalBuilder::resolve( $uses );

				if ( is_null( $guard ) )
					throw new AccountException( "We could not resolve the guard [" . $uses . "]" );

				if ( !is_subclass_of( $guard, Guard::class ) )
					throw new \InvalidArgumentException( "The guard [" . $uses . "] must extend the [" . Guard::class . "] class" );
			}
		}

		return $guard;
	}
800740
public function ifGuest($guard = null)
    {
        $this->hideCallbacks->push(function () use ($guard) {
            return auth()->guard($guard)->user();
        });

        return $this;
    }
858409
public function handle($request, Closure $next, $guard)
    {
        // Set the preferred guard for this request.
        auth()->shouldUse($guard);

        return $next($request);
    }
86450
public function seeCredentials(array $credentials, $guard = null)
    {
        $this->assertTrue(
            $this->hasCredentials($credentials, $guard), 'The given credentials are invalid.'
        );

        return $this;
    }
611165
protected function getScene($scene = '') {
        if (empty($scene)) {
            // 读取指定场景
            $scene = $this->currentScene;
        }

        if (empty($scene)) {
            return;
        }

        $this->only = $this->append = $this->remove = [];

        if (method_exists($this, 'scene' . $scene)) {
            call_user_func([$this, 'scene' . $scene]);
        }
        elseif (isset($this->scene[$scene])) {
            // 如果设置了验证适用场景
            $scene = $this->scene[$scene];

            if (is_string($scene)) {
                $scene = explode(',', $scene);
            }

            $this->only = $scene;
        }
    }
3669
function addGuard(guard, expr) {
      let safeExpr = null;
      if (!isWellFormed(expr)) {
        expr = '{/*Malformed Expression*/}';
      }
      needsRuntime = true;
      safeExpr = ` rt_${ unpredictableSuffix }.${ guard }(${ expr }) `;
      return safeExpr;
    }
200434
public function handle(Request $request, Closure $next, MediaTypeGuard $guard = null)
    {
        //
        $guard = $guard ?? app(MediaTypeGuard::class);

        if (!$guard->validateExistingContentType($request) || !$guard->hasCorrectHeadersForData($request)) {
            $errors = (new ErrorCollection())->add(ErrorFactory::buildUnsupportedMediaType());
            $encoder = Encoder::instance([], new EncoderOptions(JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));

            return new Response($encoder->encodeErrors($errors), 415, ['Content-Type' => $guard->getContentType()]);
        }

        if (!$guard->hasCorrectlySetAcceptHeader($request)) {
            $errors = (new ErrorCollection())->add(ErrorFactory::buildUnacceptable());
            $encoder = Encoder::instance([], new EncoderOptions(JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));

            return new Response($encoder->encodeErrors($errors), 406, ['Content-Type' => $guard->getContentType()]);
        }

        $response = $next($request);
        $response->header('Content-Type', $guard->getContentType());

        return $response;
    }
543875
private function evaluateGuard(EventInterface $event)
    {
        foreach ((array) $this->guardEvaluators as $guardEvaluator) {
            $result = call_user_func([$guardEvaluator, 'evaluate'], $event, $this->getPayload(), $this);
            if (!$result) {
                return false;
            }
        }

        return true;
    }
1178930
public function handle($request, Closure $next, $guard = null)
    {
        return Auth::guard($guard)->basic() ?: $next($request);
    }
925255
protected function ensureModelSharesGuard($roleOrPermission)
    {
        if (! $this->getGuardNames()->contains($roleOrPermission->guard_name)) {
            throw GuardDoesNotMatch::create($roleOrPermission->guard_name, $this->getGuardNames());
        }
    }