/** * Register the service provider. * * @return void */ public function register() { // Configure any bindings that are version dependent $this->provider->register(); // Let the IoC container be able to make a Symfony event dispatcher $this->app->bind('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface', 'Symfony\\Component\\EventDispatcher\\EventDispatcher'); // Setup default configurations for the GoogleMoviesClient Client $this->app->singleton('GoogleMoviesClient\\Client', function () { $config = $this->provider->config(); $options = $config['options']; // Use an Event Dispatcher that uses the Laravel event dispatcher $options['event_dispatcher'] = $this->app->make('GoogleMoviesClient\\Laravel\\Adapters\\EventDispatcherAdapter'); return new Client($options); }); }
/** * Register the service provider. * * @return void */ public function register() { // Configure any bindings that are version dependent $this->provider->register(); // Let the IoC container be able to make a Symfony event dispatcher $this->app->bind('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface', 'Symfony\\Component\\EventDispatcher\\EventDispatcher'); // Setup default configurations for the Tmdb Client $this->app->singleton('Tmdb\\Client', function () { $config = $this->provider->config(); $options = $config['options']; // Use an Event Dispatcher that uses the Laravel event dispatcher $options['event_dispatcher'] = $this->app->make('Tmdb\\Laravel\\Adapters\\EventDispatcherAdapter'); // Register the client using the key and options from config $token = new ApiToken($config['api_key']); return new Client($token, $options); }); // bind the configuration (used by the image helper) $this->app->bind('Tmdb\\Model\\Configuration', function () { $configuration = $this->app->make('Tmdb\\Repository\\ConfigurationRepository'); return $configuration->load(); }); }