/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events */ public function subscribe($events) { $events->listen(\App\Events\Frontend\Auth\UserLoggedIn::class, 'App\\Listeners\\Frontend\\Auth\\UserEventListener@onLoggedIn'); $events->listen(\App\Events\Frontend\Auth\UserLoggedOut::class, 'App\\Listeners\\Frontend\\Auth\\UserEventListener@onLoggedOut'); $events->listen(\App\Events\Frontend\Auth\UserRegistered::class, 'App\\Listeners\\Frontend\\Auth\\UserEventListener@onRegistered'); $events->listen(\App\Events\Frontend\Auth\UserConfirmed::class, 'App\\Listeners\\Frontend\\Auth\\UserEventListener@onConfirmed'); }
/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events * @return void */ public function subscribe($events) { Recipe::observe('App\\Observers\\RecipeModelObserver'); $events->listen('App\\Events\\Recipe\\RecipeCreated', 'App\\Listeners\\RecipeEventListener@onRecipeCreated'); $events->listen('App\\Events\\Recipe\\RecipeUpdated', 'App\\Listeners\\RecipeEventListener@onRecipeUpdated'); $events->listen('App\\Events\\Recipe\\RecipeDeleted', 'App\\Listeners\\RecipeEventListener@onRecipeDeleted'); }
/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events * @return void */ public function subscribe($events) { Ingredient::observe('App\\Observers\\IngredientModelObserver'); $events->listen('App\\Events\\Ingredient\\IngredientCreated', 'App\\Listeners\\IngredientEventListener@onIngredientCreated'); $events->listen('App\\Events\\Ingredient\\IngredientUpdated', 'App\\Listeners\\IngredientEventListener@onIngredientUpdated'); $events->listen('App\\Events\\Ingredient\\IngredientDeleted', 'App\\Listeners\\IngredientEventListener@onIngredientDeleted'); }
/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events */ public function subscribe($events) { $events->listen('cms\\Domain\\Users\\Users\\Events\\UserCreatedEvent', 'cms\\App\\Listeners\\UsersEventsListener@handleUserCreatedEvent'); $events->listen('cms\\Domain\\Users\\Users\\Events\\UserUpdatedEvent', 'cms\\App\\Listeners\\UsersEventsListener@handleUserUpdatedEvent'); $events->listen('cms\\Domain\\Users\\Users\\Events\\UserDeletedEvent', 'cms\\App\\Listeners\\UsersEventsListener@handleUserDeletedEvent'); $events->listen('cms\\Domain\\Users\\Users\\Events\\NewUserRegisteredEvent', 'cms\\App\\Listeners\\UsersEventsListener@newUserRegisteredEvent'); }
/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('App\\Form\\Customer\\Register', 'App\\Handlers\\Forms\\Customer\\AuthHandler@register', 10); $events->listen('App\\Form\\Customer\\Login', 'App\\Handlers\\Forms\\Customer\\AuthHandler@login', 10); $events->listen('App\\Form\\Customer\\ForgotPassword', 'App\\Handlers\\Forms\\Customer\\AuthHandler@forgot_password', 10); $events->listen('App\\Form\\Customer\\ResetPassword', 'App\\Handlers\\Forms\\Customer\\AuthHandler@reset_password', 10); }
/** * Listen to the events. * * @param \Illuminate\Events\Dispatcher $dispatcher * @return void */ public function subscribe(Dispatcher $dispatcher) { $dispatcher->listen('cartalyst.cart.added', __CLASS__ . '@onItemAdded'); $dispatcher->listen('cartalyst.cart.updated', __CLASS__ . '@onItemUpdated'); $dispatcher->listen('cartalyst.cart.removed', __CLASS__ . '@onItemRemoved'); $dispatcher->listen('cartalyst.cart.cleared', __CLASS__ . '@onCartCleared'); }
/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('auth.logout', 'App\\Handlers\\Events\\CartHandler@customer_logout'); $events->listen('auth.login', 'App\\Handlers\\Events\\CartHandler@customer_login'); $events->listen('App\\Events\\Cart\\Shipment\\CollectMethods', 'App\\Handlers\\Events\\CartHandler@shipment_methods'); $events->listen('App\\Events\\Cart\\Payment\\CollectMethods', 'App\\Handlers\\Events\\CartHandler@payment_methods'); }
/** * {@inheritDoc} */ public function subscribe(Dispatcher $dispatcher) { $dispatcher->listen('ocs.test.yyy.creating', __CLASS__ . '@creating'); $dispatcher->listen('ocs.test.yyy.created', __CLASS__ . '@created'); $dispatcher->listen('ocs.test.yyy.updating', __CLASS__ . '@updating'); $dispatcher->listen('ocs.test.yyy.updated', __CLASS__ . '@updated'); $dispatcher->listen('ocs.test.yyy.deleted', __CLASS__ . '@deleted'); }
/** * {@inheritDoc} */ public function subscribe(Dispatcher $dispatcher) { $dispatcher->listen('sanatorium.shopvariants.variant.creating', __CLASS__ . '@creating'); $dispatcher->listen('sanatorium.shopvariants.variant.created', __CLASS__ . '@created'); $dispatcher->listen('sanatorium.shopvariants.variant.updating', __CLASS__ . '@updating'); $dispatcher->listen('sanatorium.shopvariants.variant.updated', __CLASS__ . '@updated'); $dispatcher->listen('sanatorium.shopvariants.variant.deleted', __CLASS__ . '@deleted'); }
/** * {@inheritDoc} */ public function subscribe(Dispatcher $dispatcher) { $dispatcher->listen('ocs.standardforms.bookreferees.creating', __CLASS__ . '@creating'); $dispatcher->listen('ocs.standardforms.bookreferees.created', __CLASS__ . '@created'); $dispatcher->listen('ocs.standardforms.bookreferees.updating', __CLASS__ . '@updating'); $dispatcher->listen('ocs.standardforms.bookreferees.updated', __CLASS__ . '@updated'); $dispatcher->listen('ocs.standardforms.bookreferees.deleted', __CLASS__ . '@deleted'); }
/** * {@inheritDoc} */ public function subscribe(Dispatcher $dispatcher) { $dispatcher->listen('sanatorium.shoporders.deliverytype.creating', __CLASS__ . '@creating'); $dispatcher->listen('sanatorium.shoporders.deliverytype.created', __CLASS__ . '@created'); $dispatcher->listen('sanatorium.shoporders.deliverytype.updating', __CLASS__ . '@updating'); $dispatcher->listen('sanatorium.shoporders.deliverytype.updated', __CLASS__ . '@updated'); $dispatcher->listen('sanatorium.shoporders.deliverytype.deleted', __CLASS__ . '@deleted'); }
/** * {@inheritDoc} */ public function subscribe(Dispatcher $dispatcher) { $dispatcher->listen('ocs.standardforms.joincompetition.creating', __CLASS__ . '@creating'); $dispatcher->listen('ocs.standardforms.joincompetition.created', __CLASS__ . '@created'); $dispatcher->listen('ocs.standardforms.joincompetition.updating', __CLASS__ . '@updating'); $dispatcher->listen('ocs.standardforms.joincompetition.updated', __CLASS__ . '@updated'); $dispatcher->listen('ocs.standardforms.joincompetition.deleted', __CLASS__ . '@deleted'); }
/** * Bind the given JavaScript to the view. * * @param string $js */ public function bind($js) { foreach ($this->views as $view) { $this->event->listen("composing: {$view}", function () use($js) { echo "<script>{$js}</script>"; }); } }
/** * {@inheritDoc} */ public function subscribe(Dispatcher $dispatcher) { $dispatcher->listen('ocs.standardforms.contactusform.creating', __CLASS__ . '@creating'); $dispatcher->listen('ocs.standardforms.contactusform.created', __CLASS__ . '@created'); $dispatcher->listen('ocs.standardforms.contactusform.updating', __CLASS__ . '@updating'); $dispatcher->listen('ocs.standardforms.contactusform.updated', __CLASS__ . '@updated'); $dispatcher->listen('ocs.standardforms.contactusform.deleted', __CLASS__ . '@deleted'); }
/** * Event subscribe handler. * * @throws \Exception */ public function subscribe() { $method = 'handle'; if (method_exists($this, $getHandler = 'get' . Str::ucfirst($method) . 'r')) { $method = $this->{$getHandler}(); } $this->events->listen($this->getEvent(), [$this, $method]); }
/** * Map events and handlers * * @param Dispatcher $events */ public function subscribe(Dispatcher $events) { $events->listen('UserHasLoggedIn', static::class . '@onUserHasLoggedIn'); $events->listen('UserHasLoggedOut', static::class . '@onUserHasLoggedOut'); $events->listen('NewUserRegistered', static::class . '@onNewUserRegistered'); $events->listen('UserActivated', static::class . '@onUserActivated'); $events->listen('UserHasCancelled', static::class . '@onUserDeleted'); }
/** * @param string $class * @param \Illuminate\Events\Dispatcher $events */ protected function addHandlers(string $class, Dispatcher $events) { $baseName = class_basename($class); $created = 'eloquent.created: ' . $class; $events->listen($created, self::class . '@on' . $baseName . 'Create'); $updated = 'eloquent.updated: ' . $class; $events->listen($updated, self::class . '@on' . $baseName . 'Edit'); }
/** * {@inheritDoc} */ public function subscribe(Dispatcher $dispatcher) { $dispatcher->listen('sanatorium.shoppricing.money.creating', __CLASS__ . '@creating'); $dispatcher->listen('sanatorium.shoppricing.money.created', __CLASS__ . '@created'); $dispatcher->listen('sanatorium.shoppricing.money.updating', __CLASS__ . '@updating'); $dispatcher->listen('sanatorium.shoppricing.money.updated', __CLASS__ . '@updated'); $dispatcher->listen('sanatorium.shoppricing.money.deleted', __CLASS__ . '@deleted'); }
/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('sentinel.user.login', 'Sentinel\\Listeners\\UserEventListener@onUserLogin', 10); $events->listen('sentinel.user.logout', 'Sentinel\\Listeners\\UserEventListener@onUserLogout', 10); $events->listen('sentinel.user.registered', 'Sentinel\\Listeners\\UserEventListener@welcome', 10); $events->listen('sentinel.user.resend', 'Sentinel\\Listeners\\UserEventListener@welcome', 10); $events->listen('sentinel.user.reset', 'Sentinel\\Listeners\\UserEventListener@passwordReset', 10); }
/** * {@inheritDoc} */ public function subscribe(Dispatcher $dispatcher) { $dispatcher->listen('ocs.finance.transaction.creating', __CLASS__ . '@creating'); $dispatcher->listen('ocs.finance.transaction.created', __CLASS__ . '@created'); $dispatcher->listen('ocs.finance.transaction.updating', __CLASS__ . '@updating'); $dispatcher->listen('ocs.finance.transaction.updated', __CLASS__ . '@updated'); $dispatcher->listen('ocs.finance.transaction.deleted', __CLASS__ . '@deleted'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events */ public function subscribe(\Illuminate\Events\Dispatcher $events) { $class = 'Nasqueron\\Notifications\\Listeners\\NotificationListener'; $events->listen('Nasqueron\\Notifications\\Events\\DockerHubPayloadEvent', "{$class}@onDockerHubPayload"); $events->listen('Nasqueron\\Notifications\\Events\\GitHubPayloadEvent', "{$class}@onGitHubPayload"); $events->listen('Nasqueron\\Notifications\\Events\\JenkinsPayloadEvent', "{$class}@onJenkinsPayload"); $events->listen('Nasqueron\\Notifications\\Events\\PhabricatorPayloadEvent', "{$class}@onPhabricatorPayload"); }
/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events * * @return void */ public function subscribe(Dispatcher $events) { $events->listen('navigation.main', 'App\\Subscribers\\NavigationSubscriber@onNavigationMainFirst', 8); $events->listen('navigation.main', 'App\\Subscribers\\NavigationSubscriber@onNavigationMainSecond', 5); $events->listen('navigation.main', 'App\\Subscribers\\NavigationSubscriber@onNavigationMainThird', 2); $events->listen('navigation.bar', 'App\\Subscribers\\NavigationSubscriber@onNavigationBarFirst', 8); $events->listen('navigation.bar', 'App\\Subscribers\\NavigationSubscriber@onNavigationBarSecond', 5); $events->listen('navigation.bar', 'App\\Subscribers\\NavigationSubscriber@onNavigationBarThird', 2); }
/** * Register the listeners for the subscriber. * * @param Dispatcher $events */ public function subscribe($events) { if (config('login-activity.track_login', false)) { $events->listen(\Illuminate\Auth\Events\Login::class, 'Aginev\\LoginActivity\\LoginActivityListener@onUserLogin'); } if (config('login-activity.track_logout', false)) { $events->listen(\Illuminate\Auth\Events\Logout::class, 'Aginev\\LoginActivity\\LoginActivityListener@onUserLogout'); } }
/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events * * @return array */ public function subscribe(Dispatcher $events) { $events->listen(DiskUsageHealthy::class, static::class . '@whenDiskUsageHealthy'); $events->listen(DiskUsageAlarm::class, static::class . '@whenDiskUsageAlarm'); $events->listen(HttpPingUp::class, static::class . '@whenHttpPingUp'); $events->listen(HttpPingDown::class, static::class . '@whenHttpPingDown'); $events->listen(SSLCertificateValid::class, static::class . '@whenSSLCertificateValid'); $events->listen(SSLCertificateInvalid::class, static::class . '@whenSSLCertificateInvalid'); $events->listen(SSLCertificateExpiring::class, static::class . '@whenSSLCertificateExpiring'); }
/** * Bind the given JavaScript to the * view using Laravel event listeners * * @param $js The ready-to-go JS */ public function bind($js) { if (!is_array($this->viewToBindVariables)) { $this->viewToBindVariables = [$this->viewToBindVariables]; } foreach ($this->viewToBindVariables as $viewVariable) { $this->event->listen("composing: {$viewVariable}", function () use($js) { echo "<script>{$js}</script>"; }); } }
/** * Register the listeners for the subscriber. * * @param \Illuminate\Events\Dispatcher $events */ public function subscribe($events) { $this->fireSegmentEvent('subscribe', [$events]); foreach ($this->handles() as $handle) { switch (count($handle)) { case 2: $events->listen($handle[0], $handle[1]); break; case 3: $events->listen($handle[0], $handle[1], $handle[2]); break; } } $this->fireSegmentEvent('subscribed', [$events]); }
/** * Register a model event with the dispatcher. * * @param string $event * @param \Closure|string $callback * @return void */ protected static function registerEvent($event, $callback) { if (isset(static::$dispatcher)) { $name = get_called_class(); static::$dispatcher->listen("{$event}: {$name}", $callback); } }
/** * Register a new callback handler for when * a log event is triggered. * * @param \Closure $callback * @return void * * @throws \RuntimeException */ public function listen(Closure $callback) { if (!isset($this->dispatcher)) { throw new \RuntimeException("Events dispatcher has not been set."); } $this->dispatcher->listen('illuminate.log', $callback); }
function __construct() { parent::__construct(); // Get CI instance to obtain DB settings $ci =& get_instance(); $this->addConnection(array('driver' => 'mysql', 'host' => $ci->db->hostname, 'database' => $ci->db->database, 'username' => $ci->db->username, 'password' => $ci->db->password, 'charset' => $ci->db->char_set, 'collation' => $ci->db->dbcollat, 'prefix' => $ci->db->dbprefix)); // Listen to Model related events (saving, saved, updating, updated, creating, created etc). $this->setEventDispatcher(new Dispatcher(new Container())); // For CI Profiler (debugging utility) $events = new Dispatcher(); $events->listen('illuminate.query', function ($query, $bindings, $time, $name) { // Format binding data for sql insertion foreach ($bindings as $i => $binding) { if ($binding instanceof \DateTime) { $bindings[$i] = $binding->format('\'Y-m-d H:i:s\''); } else { if (is_string($binding)) { $bindings[$i] = "'{$binding}'"; } } } // Insert bindings into query $query = str_replace(array('%', '?'), array('%%', '%s'), $query); $query = vsprintf($query, $bindings); // Add it into CodeIgniter $ci =& get_instance(); $ci->db->query_times[] = $time; $ci->db->queries[] = $query; }); $this->setEventDispatcher($events); $this->setAsGlobal(); $this->bootEloquent(); }
/** * Bind the given JavaScript to the * view using Laravel event listeners * * @param $scope The scope to load */ public function putarticle($scope) { $lang = $this->app->getLocale(); $listo = false; try { $articles = Article::where("scope", "=", $scope)->where("lang", "=", $lang)->get(); if (count($articles)) { $listo = true; } else { $articles = Article::where("scope", "=", $scope)->get(); if (count($articles)) { $listo = true; //return $article->content . "<span class='label label-warning'>" . $article->lang . "</span>"; } else { $jsarray = $langfile; } } } catch (Exception $ex) { return $scope . " - Error:" . print_r($ex, true); } if ($listo) { if (count($articles) > 1) { $trans = []; foreach ($articles as $article) { $trans[$article->nickname] = $article->content; } $jsarray = json_encode($trans); } else { $jsarray = $article->content; } } $this->event->listen("composing: {$this->viewToBind}", function () use($jsarray, $scope) { echo "<script>window.{$this->basevar} = window.{$this->basevar} || {};{$this->basevar}.{$scope} = {$jsarray};</script>"; }); }