当前位置: 首页>>代码示例>>PHP>>正文


PHP Dispatcher::listen方法代码示例

本文整理汇总了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']);
 }
开发者ID:lazyboywu,项目名称:edufunbbs,代码行数:10,代码来源:CreatePostWhenDiscussionIsLocked.php

示例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']);
 }
开发者ID:flarum,项目名称:flarum-ext-mentions,代码行数:10,代码来源:AddPostMentionedByRelationship.php

示例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']);
 }
开发者ID:cmaas,项目名称:tags,代码行数:10,代码来源:AddForumTagsRelationship.php

示例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']);
 }
开发者ID:redstarxz,项目名称:flarumone,代码行数:7,代码来源:NotifyDiscussionStickied.php

示例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']);
 }
开发者ID:asifalimd,项目名称:core,代码行数:10,代码来源:DiscussionMetadataUpdater.php

示例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');
 }
开发者ID:df-arif,项目名称:df-core,代码行数:14,代码来源:ServiceEventHandler.php

示例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');
 }
开发者ID:Qiang1234,项目名称:core,代码行数:12,代码来源:DiscussionMetadataUpdater.php

示例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);
 }
开发者ID:caffeinated,项目名称:beverage,代码行数:14,代码来源:EventDispatcher.php

示例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']);
 }
开发者ID:skywalker512,项目名称:FlarumChina,代码行数:11,代码来源:AddPostFlagsRelationship.php

示例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);
 }
开发者ID:mahmouddev,项目名称:Media,代码行数:8,代码来源:MediaServiceProvider.php

示例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;
 }
开发者ID:ericbarnes,项目名称:framework,代码行数:8,代码来源:Router.php

示例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>";
         });
     }
 }
开发者ID:l496501043,项目名称:PHP-Vars-To-Js-Transformer,代码行数:13,代码来源:LaravelViewBinder.php

示例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);
 }
开发者ID:shinichi81,项目名称:Laravel-Core,代码行数:15,代码来源:CommandSubscriber.php

示例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);
 }
开发者ID:DavidIWilson,项目名称:site1,代码行数:17,代码来源:ObservableTrait.php

示例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']);
 }
开发者ID:redstarxz,项目名称:flarumone,代码行数:11,代码来源:NotifyNewPosts.php


注:本文中的Illuminate\Contracts\Events\Dispatcher::listen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。