private function setUserToBeImpersonated($userId)
	{
		if (!empty($userId)) {
			if (version_compare($this->laravel->version(), '5.2.0', '<')) {
				$userModel = config('auth.model');
				$user = $userModel::find($userId);
				$this->laravel['auth']->setUser($user);
			} else {
				if (!config('openapischemas.auth_provider')) {
					$this->error('You need to specify a "auth_provider" value in your openapischemas.php configuration file first.');
					exit();
				}
				$provider = config('openapischemas.auth_provider');
				$userModel = config("auth.providers.$provider.model");
				if (!config('auth.providers.' . $provider . '.model')) {
					$this->error('No model in your config/auth.php matching auth provider "' . $provider . '" from your openapischemas.php configuration file.');
					exit();
				}
				$user = $userModel::find($userId);
				$auth_guard = config('openapischemas.auth_guard');
				$this->laravel['auth']->guard($auth_guard)->setUser($user);
			}
		}
	}
private function setUserToBeImpersonated($userId)
	{
		if (!empty($userId)) {
			if (version_compare($this->laravel->version(), '5.2.0', '<')) {
				$userModel = config('auth.model');
				$user = $userModel::find($userId);
				$this->laravel['auth']->setUser($user);
			} else {
				if (!config('openapischemas.auth_provider')) {
					$this->error('You need to specify a "auth_provider" value in your openapischemas.php configuration file first.');
					exit();
				}
				$provider = config('openapischemas.auth_provider');
				$userModel = config("auth.providers.$provider.model");
				if (!config('auth.providers.' . $provider . '.model')) {
					$this->error('No model in your config/auth.php matching auth provider "' . $provider . '" from your openapischemas.php configuration file.');
					exit();
				}
				$user = $userModel::find($userId);
				$auth_guard = config('openapischemas.auth_guard');
				$this->laravel['auth']->guard($auth_guard)->setUser($user);
			}
		}
	}
private function setUserToBeImpersonated ( $ userId ) { if ( ! empty ( $ userId ) ) { if ( version_compare ( $ this -> laravel -> version ( ) , '5.2.0' , '<' ) ) { $ userModel = config ( 'auth.model' ) ; $ user = $ userModel :: find ( $ userId ) ; $ this -> laravel [ 'auth' ] -> setUser ( $ user ) ; } else { if ( ! config ( 'openapischemas.auth_provider' ) ) { $ this -> error ( 'You need to specify a "auth_provider" value in your openapischemas.php configuration file first.' ) ; exit ( ) ; } $ provider = config ( 'openapischemas.auth_provider' ) ; $ userModel = config ( "auth.providers.$provider.model" ) ; if ( ! config ( 'auth.providers.' . $ provider . '.model' ) ) { $ this -> error ( 'No model in your config/auth.php matching auth provider "' . $ provider . '" from your openapischemas.php configuration file.' ) ; exit ( ) ; } $ user = $ userModel :: find ( $ userId ) ; $ auth_guard = config ( 'openapischemas.auth_guard' ) ; $ this -> laravel [ 'auth' ] -> guard ( $ auth_guard ) -> setUser ( $ user ) ; } } }
Set current user for Api calls

@param mixed $userId
Set current user for Api calls