Artdarek\OAuth\OAuth::setConfig PHP Method

setConfig() public method

Detect config and set data from it
public setConfig ( string $service )
$service string
    public function setConfig($service)
    {
        // if config/oauth-4-laravel.php exists use this one
        if (Config::get('oauth-5-laravel.consumers') != null) {
            $this->_storageClass = Config::get('oauth-5-laravel.storage', $this->_storageClass);
            $this->_client_id = Config::get("oauth-5-laravel.consumers.{$service}.client_id");
            $this->_client_secret = Config::get("oauth-5-laravel.consumers.{$service}.client_secret");
            $this->_scope = Config::get("oauth-5-laravel.consumers.{$service}.scope", []);
            // esle try to find config in packages configs
        } else {
            $this->_storageClass = Config::get('oauth-5-laravel::storage', $this->_storageClass);
            $this->_client_id = Config::get("oauth-5-laravel::consumers.{$service}.client_id");
            $this->_client_secret = Config::get("oauth-5-laravel::consumers.{$service}.client_secret");
            $this->_scope = Config::get("oauth-5-laravel::consumers.{$service}.scope", []);
        }
    }

Usage Example

Example #1
0
 /**
  * Detect config and set data from it
  *
  * @param string $service
  * @static 
  */
 public static function setConfig($service)
 {
     return \Artdarek\OAuth\OAuth::setConfig($service);
 }