/**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app['config']->package('edvinaskrucas/notification', __DIR__ . '/../config');
     $this->app['notification'] = $this->app->share(function ($app) {
         $config = $app['config'];
         $notification = new Notification($config->get('notification::default_container'), $config->get('notification::default_types'), $config->get('notification::default_format'), $config->get('notification::default_formats'));
         $notification->setEventDispatcher($app['events']);
         return $notification;
     });
     $this->app->bind('Krucas\\Notification\\Subscriber', function ($app) {
         return new Subscriber($app['session'], $app['config']);
     });
     $this->app['events']->subscribe('Krucas\\Notification\\Subscriber');
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->mergeConfigFrom(__DIR__ . '/../../config/notification.php', 'notification');
     $this->app->singleton('notification', function ($app) {
         $config = $app['config'];
         $notification = new Notification($config->get('notification.default_container'), $config->get('notification.default_types'), $config->get('notification.types'), $config->get('notification.default_format'), $config->get('notification.format'), $config->get('notification.default_formats'), $config->get('notification.formats'));
         $notification->setEventDispatcher($app['events']);
         return $notification;
     });
     $this->app->alias('notification', 'Krucas\\Notification\\Notification');
     $this->app->singleton('Krucas\\Notification\\Subscriber', function ($app) {
         return new Subscriber($app['session.store'], $app['config']['notification.session_key']);
     });
     $this->app->singleton('Krucas\\Notification\\Middleware\\NotificationMiddleware', function ($app) {
         return new NotificationMiddleware($app['session.store'], $app['notification'], $app['config']->get('notification.session_key'));
     });
 }
Exemplo n.º 3
0
 /**
  * Set the event dispatcher instance.
  *
  * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher
  * @return void 
  * @static 
  */
 public static function setEventDispatcher($dispatcher)
 {
     \Krucas\Notification\Notification::setEventDispatcher($dispatcher);
 }