/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('ProductUserInteraction.viewing', 'Giftertipster\\EventSubscriber\\ProductUserInteractionEventSubscriber@onViewing'); $events->listen('ProductUserInteraction.viewed', 'Giftertipster\\EventSubscriber\\ProductUserInteractionEventSubscriber@onViewed'); $events->listen('ProductUserInteraction.vendorViewed', 'Giftertipster\\EventSubscriber\\ProductUserInteractionEventSubscriber@onVendorViewed'); $events->listen('ProductUserInteraction.cartAdded', 'Giftertipster\\EventSubscriber\\ProductUserInteractionEventSubscriber@onCartAdded'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * * @return array */ public function subscribe($events) { $class = "ZEDx\\Listeners\\TemplateEventListener"; $events->listen('ZEDx\\Events\\Template\\TemplateWasCreated', $class . '@onTemplateCreate'); $events->listen('ZEDx\\Events\\Template\\TemplateWasDeleted', $class . '@onTemplateDelete'); $events->listen('ZEDx\\Events\\Template\\TemplateWasUpdated', $class . '@onTemplateUpdate'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * * @return array */ public function subscribe($events) { $class = "ZEDx\\Listeners\\FieldEventListener"; $events->listen('ZEDx\\Events\\Field\\FieldWasCreated', $class . '@onFieldCreate'); $events->listen('ZEDx\\Events\\Field\\FieldWasDeleted', $class . '@onFieldDelete'); $events->listen('ZEDx\\Events\\Field\\FieldWasUpdated', $class . '@onFieldUpdate'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * * @return array */ public function subscribe($events) { $class = "ZEDx\\Listeners\\UserEventListener"; $events->listen('ZEDx\\Events\\User\\UserWasCreated', $class . '@onUserCreate'); $events->listen('ZEDx\\Events\\User\\UserWasUpdated', $class . '@onUserUpdate'); $events->listen('ZEDx\\Events\\User\\UserWasDeleted', $class . '@onUserDelete'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * * @return array */ public function subscribe($events) { $class = "ZEDx\\Listeners\\MenuEventListener"; $events->listen('ZEDx\\Events\\Menu\\MenuWasCreated', $class . '@onMenuCreate'); $events->listen('ZEDx\\Events\\Menu\\MenuWasDeleted', $class . '@onMenuDelete'); $events->listen('ZEDx\\Events\\Menu\\MenuWasUpdated', $class . '@onMenuUpdate'); $events->listen('ZEDx\\Events\\Menu\\MenuWasMoved', $class . '@onMenuMove'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * * @return array */ public function subscribe($events) { $class = "ZEDx\\Listeners\\CategoryEventListener"; $events->listen('ZEDx\\Events\\Category\\CategoryWasCreated', $class . '@onCategoryCreate'); $events->listen('ZEDx\\Events\\Category\\CategoryWasUpdated', $class . '@onCategoryUpdate'); $events->listen('ZEDx\\Events\\Category\\CategoryWasDeleted', $class . '@onCategoryDelete'); $events->listen('ZEDx\\Events\\Category\\CategoryWasMoved', $class . '@onCategoryMove'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { //这里需申明完整类路径,否则会出现'Class UserEventListener does not exist'错误 $events->listen('YCMS\\Events\\UserLogin', 'YCMS\\Listeners\\UserEventListener@onUserLogin'); $events->listen('YCMS\\Events\\UserLogout', 'YCMS\\Listeners\\UserEventListener@onUserLogout'); $events->listen('YCMS\\Events\\UserUpdate', 'YCMS\\Listeners\\UserEventListener@onUserUpdate'); $events->listen('YCMS\\Events\\UserUpload', 'YCMS\\Listeners\\UserEventListener@onUserUpload'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return void */ public function subscribe($events) { $events->listen('Neonbug\\Common\\Events\\AdminAddEditPrepareField', function ($event) { if ($event->field['type'] != 'user_admin::add_fields.role') { return; } $event->field['values'] = ['gallery' => 'Gallery editor', 'news' => 'News editor', 'text' => 'Text editor']; }); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events */ public function subscribe($events) { $events->listen(UserLoggedInEvent::class, 'Someline\\Listeners\\User\\UserEventListener@onUserLogin'); $events->listen(UserRegisteredEvent::class, 'Someline\\Listeners\\User\\UserEventListener@onUserRegistered'); // $events->listen( // 'Someline\Events\UserLoggedOut', // 'Someline\Listeners\UserEventListener@onUserLogout' // ); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('Illuminate\\Auth\\Events\\Login', self::class . '@onLogin'); $events->listen('Illuminate\\Auth\\Events\\Logout', self::class . '@onLogout'); //query execult $events->listen('Illuminate\\Database\\Events\\QueryExecuted', self::class . '@onQueryExec'); $events->listen('eloquent.*', self::class . '@onEloquent'); //Illuminate\Database\Events\TransactionBeginning //Illuminate\Database\Events\TransactionCommitted //Illuminate\Database\Events\TransactionRolledBack }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return void */ public function subscribe($events) { $events->listen('Neonbug\\Common\\Events\\AdminAddEditPrepareField', function ($event) { if ($event->field['type'] != 'dropdown') { return; } if (array_key_exists('values', $event->field)) { //do nothing, we already have the values } else { if (array_key_exists('from', $event->field) && array_key_exists('value_field', $event->field) && array_key_exists('title_field', $event->field)) { $class = $event->field['from']; if (array_key_exists($class, $this->cache)) { $items = $this->cache[$class]; } else { $items = $class::all(); $this->cache[$class] = $items; } $language = App::make('Language'); $resource_repo = App::make('ResourceRepository'); $resource_repo->inflateObjectsWithValues($items, $language->id_language); $value_field = $event->field['value_field']; $title_field = $event->field['title_field']; $values = []; foreach ($items as $item) { $values[$item->{$value_field}] = $item->{$title_field}; } $event->field['values'] = $values; } else { if (array_key_exists('repository', $event->field) && array_key_exists('method', $event->field)) { $repo_class = $event->field['repository']; $method = $event->field['method']; $key = $repo_class . '::' . $method; if (array_key_exists($key, $this->cache)) { $values = $this->cache[$key]; } else { $repo = App::make($repo_class); $values = $repo->{$method}(); $this->cache[$key] = $values; } //remove the value of the item we're currently editing if (array_key_exists('skip_item_id', $event->field) && $event->field['skip_item_id'] === true && $event->item != null && array_key_exists($event->item->{$event->item->getKeyName()}, $values)) { unset($values[$event->item->{$event->item->getKeyName()}]); } $event->field['values'] = $values; } } } if (array_key_exists('default_value', $event->field)) { $event->field['value'] = $event->field['default_value']; } }); }
/** * @test */ function empresa_registry() { $repository = $this->getMock(EmpresaRepository::class); $events = new \Illuminate\Events\Dispatcher(); $fired = false; $events->listen(EmpresaRegistrada::Class, function (EmpresaRegistrada $event) use(&$fired) { $fired = true; }); $registry = new EmpresaRegistro($repository, $events); $company = $registry->register("Probadora de Registro", "J-22222222-2"); $this->assertInstanceOf(Empresa::class, $company); $this->assertTrue($fired); }
/** * Log a query in the connection's query log. * * @param string $query * @param array $bindings * @return void */ public function logQuery($query, $bindings, $time = null) { if (isset($this->events)) { $this->events->fire('illuminate.query', array($query, $bindings, $time)); } $this->queryLog[] = compact('query', 'bindings', 'time'); }
/** * Log a query in the connection's query log. * * @param string $query * @param array $bindings * @return void */ public function logQuery($query, $bindings, $time = null) { if (isset($this->events)) { $parameters = compact('query', 'bindings', 'time'); $this->events->fire('illuminate.query', func_get_args()); } $this->queryLog[] = compact('query', 'bindings', 'time'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * * @return array */ public function subscribe($events) { $class = "ZEDx\\Listeners\\SubscriptionEventListener"; $events->listen('ZEDx\\Events\\Subscription\\SubscriptionWasPurchased', $class . '@onSubscriptionPurchase'); $events->listen('ZEDx\\Events\\Subscription\\SubscriptionWasSwaped', $class . '@onSubscriptionSwap'); $events->listen('ZEDx\\Events\\Subscription\\SubscriptionWasCreated', $class . '@onSubscriptionCreate'); $events->listen('ZEDx\\Events\\Subscription\\SubscriptionWasDeleted', $class . '@onSubscriptionDelete'); $events->listen('ZEDx\\Events\\Subscription\\SubscriptionWasUpdated', $class . '@onSubscriptionUpdate'); }
/** * Empty the cart * * @return boolean */ public function destroy() { // Fire the cart.destroy event $this->event->fire('cart.destroy'); $result = $this->updateCart(NULL); // Fire the cart.destroyed event $this->event->fire('cart.destroyed'); return $result; }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * * @return array */ public function subscribe($events) { $class = "ZEDx\\Listeners\\PageEventListener"; $events->listen('ZEDx\\Events\\Page\\PageTemplateWasSwitched', $class . '@onPageTemplateSwitch'); $events->listen('ZEDx\\Events\\Page\\PageThemepartialWasAttached', $class . '@onPageThemepartialAttach'); $events->listen('ZEDx\\Events\\Page\\PageThemepartialWasDetached', $class . '@onPageThemepartialDetach'); $events->listen('ZEDx\\Events\\Page\\PageWasCreated', $class . '@onPageCreate'); $events->listen('ZEDx\\Events\\Page\\PageWasDeleted', $class . '@onPageDelete'); $events->listen('ZEDx\\Events\\Page\\PageWasUpdated', $class . '@onPageUpdate'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { // delete a Transaction: $events->listen('eloquent.deleted: Transaction', 'CacheEventHandler@CRUDTransaction'); // edit or create a Transaction (also original catch for saving). $events->listen('eloquent.saving: Transaction', 'CacheEventHandler@CRUDTransaction'); $events->listen('eloquent.saved: Transaction', 'CacheEventHandler@CRUDTransaction'); // debug save / before save // create a transfer $events->listen('eloquent.created: Transfer', 'CacheEventHandler@createdTransfer'); // create anything or delete anything. $events->listen('eloquent.created: *', 'CacheEventHandler@createdAll'); $events->listen('eloquent.deleted: *', 'CacheEventHandler@deletedAll'); }
/** * Register the listeners for the subscriber. * @param Illuminate\Events\Dispatcher $event * @return void */ public function subscribe($event) { $class = get_class($this); $event->listen('auth.login', $class . '@onLogin'); $event->listen('eloquent.created: App\\User', $class . '@onRegister'); $event->listen('eloquent.updating: App\\User', $class . '@onUpdating'); # for customer component if (class_exists('Components\\Customer\\Models\\User')) { $event->listen('eloquent.created: Components\\Customer\\Models\\User', $class . '@onRegister'); $event->listen('eloquent.updating: Components\\Customer\\Models\\User', $class . '@onUpdating'); } }
/** * Block Factory. * * @param string $type * @param string $name * @param array $attributes * * @return \Layout\Block */ public function createBlock($class, $name = '', array $attributes = []) { try { $block = $this->_getBlockInstance($class, $attributes); } catch (Exception $e) { \Log::exception($e); return false; } if (empty($name) || '.' === $name[0]) { $block->setIsAnonymous(true); if (!empty($name)) { $block->setAnonSuffix(substr($name, 1)); } $name = 'ANONYMOUS_' . sizeof($this->_blocks); } $block->setClass($class); $block->setNameInLayout($name); $block->addData($attributes); $block->setLayout($this); $this->_blocks[$name] = $block; $this->events->fire('layout.block.create.after', ['block' => $block]); return $this->_blocks[$name]; }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return void */ public function subscribe($events) { $events->listen('javidsapand\\Forum\\Events\\ThreadWasViewed', 'javidsapand\\Forum\\Handlers\\Events\\IncrementThreadViewCount@handle'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events */ public function subscribe($events) { $events->listen('*.entity.created', __CLASS__ . '@entityCreated'); $events->listen('*.entity.updated', __CLASS__ . '@entityUpdated'); $events->listen('*.entity.deleted', __CLASS__ . '@entityDeleted'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('App\\Events\\UserLoggedIn', 'App\\Listeners\\UserEventListener@onUserLogin'); $events->listen('App\\Events\\UserLoggedOut', 'App\\Listeners\\UserEventListener@onUserLogout'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('auth.login', 'UserEventHandler@onUserLogin'); $events->listen('auth.logout', 'UserEventHandler@onUserLogout'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('adjustment.create', 'AdjustmentsEventHandler@updateAdjustmentProducts'); $events->listen('adjustment.create', 'AdjustmentsEventHandler@updateLocationProducts'); $events->listen('adjustment.create', 'AdjustmentsEventHandler@updateItemInAndOut'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('user.login', 'UserEventHandler@onUserLogin'); $events->listen('user.logout', 'UserEventHandler@onUserLogout'); $events->listen('user.register', 'UserEventHandler@onUserRegister'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return void */ public function subscribe($events) { $events->listen('App\\Events\\SomeTriggerEvent', 'App\\Subscribers\\SomeTriggerEventSubscriber@onTrigger1'); $events->listen('App\\Events\\SomeTriggerEvent', 'App\\Subscribers\\SomeTriggerEventSubscriber@onTrigger2'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('public_routes.created', 'Cms\\Events\\Crud\\PublicRoutesEventHandler@onCreate'); $events->listen('public_routes.updated', 'Cms\\Events\\Crud\\PublicRoutesEventHandler@onUpdate'); $events->listen('public_routes.deleted', 'Cms\\Events\\Crud\\PublicRoutesEventHandler@onDelete'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events * @return array */ public function subscribe($events) { $events->listen('user.create', 'UserEventSubscriber@onCreate'); $events->listen('user.update', 'UserEventSubscriber@onUpdate'); }
/** * Register the listeners for the subscriber. * * @param Illuminate\Events\Dispatcher $events */ public function subscribe($events) { $events->listen('tymon.jwt.valid', 'App\\Listeners\\JWTEventListener@onValidUser'); }