/** * @param array $config * @param ServiceInterface $service * @param array $options * @param $id */ public function __construct(array $config, ServiceInterface $service, array $options, $id) { $this->config = $config; $this->service = $service; $this->options = $options; $this->id = $id; static::$provider = $service->service(); }
/** * Load session provider * * @param ProviderInterface $provider * @return ProviderInterface */ public static function provider(ProviderInterface $provider = null) { if ($provider) { static::$provider = $provider; } elseif (!static::$provider) { static::$provider = new Provider\Native(static::$root); } return static::$provider; }
/** * Sets the provider instance * * @param ValidationAwareInterface $provider */ public static function setProvider(ValidationAwareInterface $provider) { static::$provider = $provider; static::$provider->setData(static::properties()); }
protected function getProvider() { if (!empty(static::$provider)) { return static::$provider; } $providerProvider = app(ProviderProvider::class); $providerAttributes = ['name' => 'Main Provider', 'api_secret' => 'foobar', 'slug' => 'foo']; $mainProvider = $providerProvider->find($providerAttributes); if (empty($mainProvider)) { $mainProvider = $providerProvider->create($providerAttributes); } static::$provider = $mainProvider; return $mainProvider; }