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


PHP Event::subscribe方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Event::subscribe方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::subscribe方法的具体用法?PHP Event::subscribe怎么用?PHP Event::subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\Event的用法示例。


在下文中一共展示了Event::subscribe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: boot

 public function boot(Guard $guard, MixPanel $mixPanel)
 {
     include __DIR__ . '/Http/routes.php';
     $this->app->make(config('auth.model'))->observe(new MixPanelUserObserver($mixPanel));
     $eventHandler = new MixPanelEventHandler($guard, $mixPanel);
     Event::subscribe($eventHandler);
 }
开发者ID:janusnic,项目名称:MixPanel,代码行数:7,代码来源:MixPanelServiceProvider.php

示例2: boot

 public function boot(Request $request, Guard $guard, LaravelMixpanel $mixPanel)
 {
     include __DIR__ . '/../Http/routes.php';
     $this->app->make(config('auth.model'))->observe(new LaravelMixpanelUserObserver($request, $mixPanel));
     $eventHandler = new LaravelMixpanelEventHandler($request, $guard, $mixPanel);
     Event::subscribe($eventHandler);
 }
开发者ID:emergingdzns,项目名称:laravel-mixpanel,代码行数:7,代码来源:LaravelMixpanelServiceProvider.php

示例3: boot

 /**
  * Register the application's event listeners.
  *
  * @return void
  */
 public function boot()
 {
     $add_hook = function ($type, $name, $listeners) {
         $listeners = is_array($listeners) ? $listeners : [$listeners];
         array_walk($listeners, function ($listener) use($type, $name) {
             $fn = 'add_' . $type;
             // `add_action` or `add_filter`
             $fn($name, function () use($listener) {
                 $listener_instance = app()->make($listener);
                 return call_user_func_array([$listener_instance, 'handle'], func_get_args());
             }, 10, 10);
         });
     };
     foreach ($this->listens() as $event => $listeners) {
         $listeners = is_array($listeners) ? $listeners : [$listeners];
         foreach ($listeners as $listener) {
             Event::listen($event, $listener);
         }
     }
     foreach ($this->subscribe as $subscriber) {
         Event::subscribe($subscriber);
     }
     foreach ($this->action as $action => $listeners) {
         $add_hook('action', $action, $listeners);
     }
     foreach ($this->filter as $filter => $listeners) {
         $add_hook('filter', $filter, $listeners);
     }
 }
开发者ID:laraish,项目名称:framework,代码行数:34,代码来源:EventServiceProvider.php

示例4: register

 public function register()
 {
     Version::addPrefixUserAgentSegment('Laravel integration', '1.7.0');
     Version::addSuffixUserAgentSegment('PHP', phpversion());
     $laravel = app();
     Version::addSuffixUserAgentSegment('Laravel', $laravel::VERSION);
     $this->registerManager();
     Event::subscribe('\\AlgoliaSearch\\Laravel\\EloquentSubscriber');
 }
开发者ID:algolia,项目名称:algoliasearch-laravel,代码行数:9,代码来源:AlgoliaServiceProvider.php

示例5: boot

 /**
  * Register the application's event listeners.
  *
  * @return void
  */
 public function boot()
 {
     foreach ($this->listens() as $event => $listeners) {
         foreach ($listeners as $listener) {
             Event::listen($event, $listener);
         }
     }
     foreach ($this->subscribe as $subscriber) {
         Event::subscribe($subscriber);
     }
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:16,代码来源:EventServiceProvider.php

示例6: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Event::subscribe('App\\Listeners\\Events\\AuthHistoryLogger');
     Event::subscribe('App\\Listeners\\Events\\UserHistoryLogger');
     Project::observe($this->app->make('App\\Events\\Observer\\ProjectObserver'));
     Entry::observe($this->app->make('App\\Events\\Observer\\EntryObserver'));
     Share::observe($this->app->make('App\\Events\\Observer\\ShareObserver'));
     Team::observe($this->app->make('App\\Events\\Observer\\TeamObserver'));
     EntryTag::observe($this->app->make('App\\Events\\Observer\\EntryTagObserver'));
     EntryTeam::observe($this->app->make('App\\Events\\Observer\\EntryTeamObserver'));
     ProjectTeam::observe($this->app->make('App\\Events\\Observer\\ProjectTeamObserver'));
     UserTeam::observe($this->app->make('App\\Events\\Observer\\UserTeamObserver'));
 }
开发者ID:vaidasm,项目名称:vault,代码行数:20,代码来源:EventServiceProvider.php

示例7: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     Event::subscribe('App\\Handlers\\Events\\AuthListener');
     parent::boot($events);
     //
 }
开发者ID:sotoplatero,项目名称:lacallemonte,代码行数:12,代码来源:EventServiceProvider.php

示例8: registerEvents

 /**
  * Register the application's event listeners.
  *
  * @return void
  */
 public function registerEvents()
 {
     foreach ($this->events as $event => $listeners) {
         foreach ($listeners as $listener) {
             Event::listen($event, $listener);
         }
     }
     foreach ($this->subscribe as $subscriber) {
         Event::subscribe($subscriber);
     }
 }
开发者ID:cornex,项目名称:forumia,代码行数:16,代码来源:AggregateServiceProvider.php

示例9: register

 public function register()
 {
     Event::subscribe('\\AlgoliaSearch\\Laravel\\EloquentSubscriber');
 }
开发者ID:crgriggs,项目名称:fishark,代码行数:4,代码来源:AlgoliaServiceProvider.php

示例10: __construct

 /**
  * Create a new controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     $subscriber = new SystemListern();
     Event::subscribe($subscriber);
     //$this->middleware('auth');
 }
开发者ID:a-suvorov,项目名称:medschedule,代码行数:11,代码来源:HomeController.php

示例11: boot

 /**
  * {@inheritDoc}
  */
 public function boot()
 {
     // Handle locations upon login
     $this->registerLocation();
     // Register timezone settings
     date_default_timezone_set(Settings::get('timezone', Config::get('app.timezone')));
     // Register ServiceProviders
     App::register('DMA\\Friends\\FriendsServiceProvider');
     App::register('Maatwebsite\\Excel\\ExcelServiceProvider');
     // Register aliases
     $alias = AliasLoader::getInstance();
     $alias->alias('Excel', 'Maatwebsite\\Excel\\Facades\\Excel');
     // Register Event Subscribers
     $subscriber = new FriendsEventHandler();
     Event::subscribe($subscriber);
     // Bind user and point events to trigger user synchronization with MailChimp
     MailChimpIntegration::bindEvents();
     // Generate barcode_id when a user object is created
     // TODO: Migrate when user plugin is forked
     User::creating(function ($user) {
         if (empty($user->barcode_id)) {
             $user->barcode_id = substr(md5($user->email), 0, 9);
         }
     });
     // Extend the user model to support our custom metadata
     User::extend(function ($model) {
         $model->hasOne['metadata'] = ['DMA\\Friends\\Models\\Usermeta', 'key' => 'user_id'];
         $model->hasMany['activityLogs'] = ['DMA\\Friends\\Models\\ActivityLog'];
         $model->hasMany['bookmarks'] = ['DMA\\Friends\\Models\\Bookmark'];
         $model->hasMany['notifications'] = ['DMA\\Friends\\Models\\Notification'];
         $model->hasMany['rates'] = ['DMA\\Friends\\Models\\UserRate'];
         $model->belongsToMany['activities'] = ['DMA\\Friends\\Models\\Activity', 'table' => 'dma_friends_activity_user', 'user_id', 'activity_id', 'timestamps' => true, 'order' => 'dma_friends_activity_user.created_at desc'];
         $model->belongsToMany['steps'] = ['DMA\\Friends\\Models\\Step', 'table' => 'dma_friends_step_user', 'user_id', 'step_id', 'timestamps' => true, 'order' => 'dma_friends_step_user.created_at desc'];
         $model->belongsToMany['badges'] = ['DMA\\Friends\\Models\\Badge', 'table' => 'dma_friends_badge_user', 'user_id', 'badge_id', 'timestamps' => true, 'order' => 'dma_friends_badge_user.created_at desc'];
         $model->belongsToMany['rewards'] = ['DMA\\Friends\\Models\\Reward', 'table' => 'dma_friends_reward_user', 'user_id', 'reward_id', 'timestamps' => true, 'order' => 'dma_friends_reward_user.created_at desc'];
         $model->belongsToMany['groups'] = ['DMA\\Friends\\Models\\UserGroup', 'table' => 'dma_friends_users_groups', 'key' => 'user_id', 'foreignKey' => 'group_id', 'pivot' => ['membership_status']];
     });
     // Extend User fields
     $context = $this;
     Event::listen('backend.form.extendFields', function ($widget) use($context) {
         $context->extendedUserFields($widget);
         $context->extendedSettingFields($widget);
     });
     Event::listen('backend.list.extendColumns', function ($widget) {
         if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) {
             return;
         }
         $widget->addColumns(['barcode_id' => ['label' => 'Barcode ID'], 'full_name' => ['label' => 'Full Name', 'relation' => 'metadata', 'sortable' => false, 'select' => "concat(first_name, ' ', last_name)", 'searchable' => true], 'first_name' => ['label' => 'First Name', 'relation' => 'metadata', 'select' => '@first_name', 'searchable' => true], 'last_name' => ['label' => 'Last Name', 'relation' => 'metadata', 'select' => '@last_name', 'searchable' => true], 'points' => ['label' => 'Points'], 'zip' => ['label' => 'Zip'], 'current_member_number' => ['label' => 'Membership ID', 'relation' => 'metadata', 'select' => '@current_member_number']]);
     });
 }
开发者ID:janusnic,项目名称:OctoberFriends,代码行数:53,代码来源:Plugin.php

示例12: function

<?php

use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Session;
// User Login event
Event::listen('user.login', function ($userId, $email) {
    Session::put('userId', $userId);
    Session::put('email', $email);
});
// User logout event
Event::listen('user.logout', function () {
    Session::flush();
});
// Subscribe to User Mailer events
Event::subscribe('Edgji\\Sentrystart\\Mailers\\UserMailer');
开发者ID:edgji,项目名称:sentrystart,代码行数:15,代码来源:observables.php

示例13: registerAuthenticationEventHandler

 private function registerAuthenticationEventHandler()
 {
     Event::subscribe('Hamedmehryar\\SessionTracker\\AuthenticationHandler');
 }
开发者ID:hamedmehryar,项目名称:laravel-session-tracker,代码行数:4,代码来源:SessionTrackerServiceProvider.php

示例14: register

 public function register()
 {
     $this->registerManager();
     Event::subscribe('\\AlgoliaSearch\\Laravel\\EloquentSubscriber');
 }
开发者ID:Nikita240,项目名称:algoliasearch-laravel,代码行数:5,代码来源:AlgoliaServiceProvider.php

示例15: defineListeners

 public function defineListeners()
 {
     Event::subscribe(new RagnarokListener());
 }
开发者ID:alfredoem,项目名称:ragnarok,代码行数:4,代码来源:RagnarokServiceProvider.php


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