本文整理汇总了PHP中Illuminate\Events\Dispatcher::listen方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::listen方法的具体用法?PHP Dispatcher::listen怎么用?PHP Dispatcher::listen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Events\Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::listen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subscribe
/**
* 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');
}
示例2: subscribe
/**
* 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');
}
示例3: subscribe
/**
* 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');
}
示例4: subscribe
/**
* 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');
}
示例5: subscribe
/**
* 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);
}
示例6: subscribe
/**
* 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');
}
示例7: subscribe
/**
* 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');
}
示例8: subscribe
/**
* {@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');
}
示例9: bind
/**
* 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>";
});
}
}
示例10: subscribe
/**
* 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]);
}
示例11: subscribe
/**
* 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');
}
示例12: addHandlers
/**
* @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');
}
示例13: subscribe
/**
* 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);
}
示例14: subscribe
/**
* 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");
}
示例15: subscribe
/**
* 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);
}