當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。