本文整理汇总了PHP中Illuminate\Contracts\Events\Dispatcher::listen方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::listen方法的具体用法?PHP Dispatcher::listen怎么用?PHP Dispatcher::listen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Events\Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::listen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subscribe
/**
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(ConfigurePostTypes::class, [$this, 'addPostType']);
$events->listen(ConfigureNotificationTypes::class, [$this, 'addNotificationType']);
$events->listen(DiscussionWasLocked::class, [$this, 'whenDiscussionWasLocked']);
$events->listen(DiscussionWasUnlocked::class, [$this, 'whenDiscussionWasUnlocked']);
}
示例2: subscribe
/**
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(GetModelRelationship::class, [$this, 'getModelRelationship']);
$events->listen(GetApiRelationship::class, [$this, 'getApiRelationship']);
$events->listen(ConfigureApiController::class, [$this, 'includeRelationships']);
$events->listen(PrepareApiData::class, [$this, 'filterVisiblePosts']);
}
示例3: subscribe
/**
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(GetApiRelationship::class, [$this, 'getApiRelationship']);
$events->listen(PrepareApiData::class, [$this, 'loadTagsRelationship']);
$events->listen(ConfigureApiController::class, [$this, 'includeTagsRelationship']);
$events->listen(PrepareApiAttributes::class, [$this, 'prepareApiAttributes']);
}
示例4: subscribe
public function subscribe(Dispatcher $events)
{
$events->listen(RegisterPostTypes::class, [$this, 'registerPostType']);
$events->listen(RegisterNotificationTypes::class, [$this, 'registerNotificationType']);
$events->listen(DiscussionWasStickied::class, [$this, 'whenDiscussionWasStickied']);
$events->listen(DiscussionWasUnstickied::class, [$this, 'whenDiscussionWasUnstickied']);
}
示例5: subscribe
/**
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(PostWasPosted::class, [$this, 'whenPostWasPosted']);
$events->listen(PostWasDeleted::class, [$this, 'whenPostWasDeleted']);
$events->listen(PostWasHidden::class, [$this, 'whenPostWasHidden']);
$events->listen(PostWasRestored::class, [$this, 'whenPostWasRestored']);
}
示例6: subscribe
/**
* Register the listeners for the subscriber.
*
* @param Dispatcher $events
*
* @return array
*/
public function subscribe($events)
{
$events->listen(ServicePreProcess::class, static::class . '@onServicePreProcess');
$events->listen(ServicePostProcess::class, static::class . '@onServicePostProcess');
$events->listen(ResourcePreProcess::class, static::class . '@onResourcePreProcess');
$events->listen(ResourcePostProcess::class, static::class . '@onResourcePostProcess');
}
示例7: subscribe
/**
* Register the listeners for the subscriber.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen('Flarum\\Core\\Events\\PostWasPosted', __CLASS__ . '@whenPostWasPosted');
$events->listen('Flarum\\Core\\Events\\PostWasDeleted', __CLASS__ . '@whenPostWasDeleted');
$events->listen('Flarum\\Core\\Events\\PostWasHidden', __CLASS__ . '@whenPostWasHidden');
$events->listen('Flarum\\Core\\Events\\PostWasRestored', __CLASS__ . '@whenPostWasRestored');
}
示例8: registerEvent
/**
* Register an event for the dispatcher to listen for.
*
* @param string $name
* @param Closure $callback
* @return void
*/
protected function registerEvent($name, Closure $callback)
{
if (!isset(static::$dispatcher)) {
$this->initEventDispatcher();
}
static::$dispatcher->listen($name, $callback);
}
示例9: subscribe
/**
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(GetModelRelationship::class, [$this, 'getModelRelationship']);
$events->listen(PostWasDeleted::class, [$this, 'postWasDeleted']);
$events->listen(GetApiRelationship::class, [$this, 'getApiRelationship']);
$events->listen(ConfigureApiController::class, [$this, 'includeFlagsRelationship']);
$events->listen(PrepareApiData::class, [$this, 'prepareApiData']);
}
示例10: boot
public function boot(DispatcherContract $events)
{
$this->registerMaxFolderSizeValidator();
$this->mergeConfigFrom(__DIR__ . '/../Config/config.php', 'asgard.media.config');
$this->publishes([__DIR__ . '/../Config/config.php' => config_path('asgard.media.config' . '.php')], 'config');
$events->listen('*', HandleMediaStorage::class);
$events->listen('*', RemovePolymorphicLink::class);
}
示例11: admin
public function admin($uri, $action)
{
$route = $this->addRoute('admin', $uri, $action);
$this->actions->listen('admin_menu', function () use($uri, $route) {
$this->addAdminMenuPage($uri, $route);
});
return $route;
}
示例12: 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>";
});
}
}
示例13: subscribe
/**
* Register the listeners for the subscriber.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
*
* @return void
*/
public function subscribe(Dispatcher $events)
{
$events->listen('command.publishvendors', __CLASS__ . '@onPublishVendors', 5);
$events->listen('command.resetmigrations', __CLASS__ . '@onResetMigrations', 5);
$events->listen('command.runmigrations', __CLASS__ . '@onRunMigrations', 5);
$events->listen('command.runseeding', __CLASS__ . '@onRunSeeding', 5);
$events->listen('command.updatecache', __CLASS__ . '@onUpdateCache', 5);
}
示例14: registerObservableEvent
/**
* Register an event with the dispatcher.
*
* @param string $event
* @param \Closure|string $callback
*
* @return void
*/
protected static function registerObservableEvent($event, $callback)
{
if (!isset(static::$dispatcher)) {
return;
}
$className = get_called_class();
$event = with(new static())->getObservableKey($event);
static::$dispatcher->listen("{$event}: {$className}", $callback);
}
示例15: subscribe
public function subscribe(Dispatcher $events)
{
$events->listen(RegisterNotificationTypes::class, [$this, 'addNotificationType']);
// Register with '1' as priority so this runs before discussion metadata
// is updated, as we need to compare the user's last read number to that
// of the previous post.
$events->listen(PostWasPosted::class, [$this, 'whenPostWasPosted'], 1);
$events->listen(PostWasHidden::class, [$this, 'whenPostWasHidden']);
$events->listen(PostWasRestored::class, [$this, 'whenPostWasRestored']);
$events->listen(PostWasDeleted::class, [$this, 'whenPostWasDeleted']);
}