/**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('shopify', function ($app, Store $store) {
         $provider = new Shopify(['clientId' => Config::get('shopify.key'), 'clientSecret' => Config::get('shopify.secret'), 'redirectUri' => URL::route('stores.setStoreToken', [$store->id])]);
         $provider->setStoreUrl($store->getUrl());
         $provider->setScopes(['read_orders', 'read_products', 'read_customers']);
         return $provider;
     });
 }
Пример #2
0
 /**
  * @return \Guzzle\Service\Client
  * @throws \Exception
  */
 public function getHttpClient()
 {
     if (!$this->getStore()) {
         throw new \Exception('Please provide Store before doing requests');
     }
     $client = parent::getHttpClient();
     $client->setDefaultOption('headers', ['X-Shopify-Access-Token' => $this->getStore()->token]);
     return $client;
 }