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


PHP Providers\EventServiceProvider类代码示例

本文整理汇总了PHP中Illuminate\Foundation\Support\Providers\EventServiceProvider的典型用法代码示例。如果您正苦于以下问题:PHP EventServiceProvider类的具体用法?PHP EventServiceProvider怎么用?PHP EventServiceProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     User::deleting(function ($user) {
         \Event::fire(new UserWasDeleted($user->id));
     });
 }
开发者ID:Rotron,项目名称:laravel5-shop,代码行数:13,代码来源:EventServiceProvider.php

示例2: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     $events->listen('auth.login', 'Ruysu\\Core\\Listeners\\AuthListener@onLogin');
     $events->listen('Ruysu\\Core\\Events\\Auth\\UserRegistered', 'Ruysu\\Core\\Listeners\\AuthListener@onRegister');
     $events->listen('Ruysu\\Core\\Events\\Auth\\UserActivated', 'Ruysu\\Core\\Listeners\\AuthListener@onActivate');
 }
开发者ID:ruysu,项目名称:laravel-core,代码行数:13,代码来源:EventServiceProvider.php

示例3: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Project::observe(new SlugGeneratorObserver());
     Category::observe(new SlugGeneratorObserver());
     Tag::observe(new SlugGeneratorObserver());
 }
开发者ID:reiniersb87,项目名称:website,代码行数:13,代码来源:EventServiceProvider.php

示例4: 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::listen('Aacotroneo\\Saml2\\Events\\Saml2LoginEvent', function (Saml2LoginEvent $event) {
         $user = $event->getSaml2User();
         /*$userData = [
               'id' => $user->getUserId(),
               'attributes' => $user->getAttributes(),
               'assertion' => $user->getRawSamlAssertion()
           ];*/
         $laravelUser = User::where("username", "=", $user->getUserId())->get()->first();
         if ($laravelUser != null) {
             Auth::login($laravelUser);
         } else {
             //if first user then create it and login
             $count = \App\User::all()->count();
             if ($count == 0) {
                 $data = array();
                 $data['lastname'] = "";
                 $data['firstname'] = "";
                 $data['username'] = $user->getUserId();
                 $data['role'] = "admin";
                 $user = \App\User::create($data);
                 \Auth::login($user);
                 return \Redirect::to('/');
             } else {
                 abort(401);
             }
         }
         //if it does not exist create it and go on  or show an error message
     });
 }
开发者ID:ghyster,项目名称:dns-angular,代码行数:38,代码来源:EventServiceProvider.php

示例5: boot

 public function boot()
 {
     // DispatcherContract $events
     // $events
     parent::boot();
     //
 }
开发者ID:Dreamerpro,项目名称:thinkmerit.api,代码行数:7,代码来源: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);
     $this->registerDeleteEvents();
     $this->registerCreateEvents();
     BudgetLimit::saved(function (BudgetLimit $budgetLimit) {
         $end = Navigation::addPeriod(clone $budgetLimit->startdate, $budgetLimit->repeat_freq, 0);
         $end->subDay();
         $set = $budgetLimit->limitrepetitions()->where('startdate', $budgetLimit->startdate->format('Y-m-d 00:00:00'))->where('enddate', $end->format('Y-m-d 00:00:00'))->get();
         if ($set->count() == 0) {
             $repetition = new LimitRepetition();
             $repetition->startdate = $budgetLimit->startdate;
             $repetition->enddate = $end;
             $repetition->amount = $budgetLimit->amount;
             $repetition->budgetLimit()->associate($budgetLimit);
             try {
                 $repetition->save();
             } catch (QueryException $e) {
                 Log::error('Trying to save new LimitRepetition failed: ' . $e->getMessage());
                 // @codeCoverageIgnore
             }
         } else {
             if ($set->count() == 1) {
                 $repetition = $set->first();
                 $repetition->amount = $budgetLimit->amount;
                 $repetition->save();
             }
         }
     });
 }
开发者ID:webenhanced,项目名称:firefly-iii,代码行数:37,代码来源:EventServiceProvider.php

示例7: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     if (!$this->isLumen()) {
         $this->publishes([$this->getConfigPath() => $this->app->make('path.config') . '/viewpresenter.php'], 'config');
     }
 }
开发者ID:neondigital,项目名称:laravel-view-presenter,代码行数:13,代码来源:ViewPresenterServiceProvider.php

示例8: boot

 /**
  * Register any other events for your application.
  *
  * @param \Illuminate\Contracts\Events\Dispatcher $events
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     if (!\Request::isMethod('GET')) {
         $events->subscribe(PushNotificationHandler::class);
     }
 }
开发者ID:adminrt,项目名称:phphub-server,代码行数:12,代码来源:EventServiceProvider.php

示例9: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     User::creating(function ($user) {
         //
     });
 }
开发者ID:ChenPeiyuan,项目名称:student-infomation-manager,代码行数:13,代码来源:EventServiceProvider.php

示例10: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     AttributeType::deleting(function ($attr) {
         $sub_attrs = Attribute::where('type_id', '=', $attr->id)->get();
         foreach ($sub_attrs as $sa) {
             $sa->delete();
         }
     });
     EntityType::deleting(function ($entity) {
         $entities = $entity->entities;
         foreach ($entities as $e) {
             $e->delete();
         }
     });
     Entity::deleting(function ($entity) {
         $alarms = $entity->alarms;
         foreach ($alarms as $a) {
             $a->delete();
         }
     });
     Alarm::deleting(function ($alarm) {
         $reminders = $alarm->history;
         foreach ($reminders as $r) {
             $r->delete();
         }
     });
 }
开发者ID:OfficineDigitali,项目名称:pendola,代码行数:34,代码来源:EventServiceProvider.php

示例11: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     $events->listen('eloquent.saving: *', function ($model) {
         \File::append('audit', "Table {$model->getTable()} has been saved." . PHP_EOL);
     });
 }
开发者ID:threening,项目名称:laraseda,代码行数:13,代码来源:EventServiceProvider.php

示例12: 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::listen('language.change', function (Language $language) {
         // Change application language
         $language->apply()->remember();
         // Update user's language
         if ($user = Auth::user()) {
             $user->language()->associate($language)->save();
         }
         // Feedback
         Session::flash('success', sprintf(_('Language changed to %s'), $language->native_name));
     });
     Event::listen('auth.login', function (User $user) {
         // Change application language to current user's language
         if ($user->language instanceof Language) {
             $user->language->apply()->remember();
         }
         // Stats
         $user->increment('login_count');
         $user->provider->increment('login_count');
         // Feedback
         Session::flash('success', sprintf(_('Logged in as %s'), $user));
     });
     Event::listen('auth.logout', function (User $user) {
         // Feedback
         Session::flash('success', _('Logged out'));
         // Reset default application language
         Language::forget();
     });
 }
开发者ID:superdol,项目名称:Wiki,代码行数:37,代码来源:EventServiceProvider.php

示例13: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Form::component('bsText', 'shared.components.text', ['name', 'label', 'required' => false, 'unit' => false, 'inputCol' => 4]);
     Form::component('bsNumber', 'shared.components.number', ['name', 'label', 'required' => false, 'unit' => false, 'inputCol' => 4]);
     Form::component('bsTextarea', 'shared.components.textarea', ['name', 'label', 'required' => false, 'rows' => 4]);
     Form::component('bsSelect', 'shared.components.select', ['name', 'label', 'choice', 'required' => false, 'unit' => false, 'inputCol' => 4]);
     Form::component('twoSelect', 'shared.components.twoSelect', ['label', 'nameA', 'choiceA', 'requiredA' => false, 'unitA' => false, 'nameB', 'choiceB', 'requiredB' => false, 'unitB' => false]);
     Form::component('bsDate', 'shared.components.date', ['name', 'label', 'required' => false]);
     /**
      * Sugar components
      */
     // playList must Laravel Collection object
     Form::component('playList', 'shared.sugar.playList', ['name', 'playList']);
     Form::component('basin', 'shared.sugar.basin', ['name']);
     Form::component('province', 'shared.sugar.province', ['name']);
     Form::component('clarified', 'shared.sugar.clarified', ['name']);
     Form::component('analogTo', 'shared.sugar.analogTo', ['name']);
     Form::component('analogDistance', 'shared.sugar.analogDistance', ['name']);
     Form::component('shore', 'shared.sugar.shore', ['name']);
     Form::component('terrain', 'shared.sugar.terrain', ['name']);
     Form::component('nearbyField', 'shared.sugar.nearbyField', ['name']);
     Form::component('nearbyInfra', 'shared.sugar.nearbyInfra', ['name']);
     Form::component('remark', 'shared.sugar.remark', ['name', 'required' => false]);
     Form::component('lateMethod', 'shared.sugar.lateMethod', ['name']);
     Form::component('seismicImage', 'shared.sugar.seismicImage', ['name']);
     Form::component('latitude', 'shared.sugar.latitude', ['name', 'required' => true]);
     Form::component('longitude', 'shared.sugar.longitude', ['name', 'required' => true]);
     Form::component('survey', 'shared.sugar.survey', ['name' => 'survey', 'choice']);
 }
开发者ID:b813813,项目名称:harleen,代码行数:36,代码来源:EventServiceProvider.php

示例14: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     $events->listen('auth.logout', function ($event) {
         Session::flush();
     });
 }
开发者ID:sanderdekroon,项目名称:yourfoodbox,代码行数:13,代码来源:EventServiceProvider.php

示例15: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     User::creating(function ($user) {
         $user->ip_address = Request::ip();
         $user->confirmation_code = str_random(60);
         $user->referral_code = str_random(10);
         $user->referral_secret = str_random(10);
         Session::put(Config::get('prelaunch.session:referral_secret'), $user->referral_secret);
     });
     User::created(function ($user) {
         $user->sendConfirmation();
     });
     # query logger
     if (App::environment('local')) {
         Event::listen('illuminate.query', function ($sql, $bindings, $time) {
             for ($i = 0; $i < sizeof($bindings); $i++) {
                 if ($bindings[$i] instanceof DateTime) {
                     $bindings[$i] = $bindings[$i]->getTimestamp();
                 }
             }
             Log::info(sprintf("%s (%s) : %s", $sql, implode(",", $bindings), $time));
         });
     }
 }
开发者ID:yizhihou2,项目名称:prelaunchr-laravel,代码行数:31,代码来源:EventServiceProvider.php


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