當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EventServiceProvider::boot方法代碼示例

本文整理匯總了PHP中Illuminate\Foundation\Support\Providers\EventServiceProvider::boot方法的典型用法代碼示例。如果您正苦於以下問題:PHP EventServiceProvider::boot方法的具體用法?PHP EventServiceProvider::boot怎麽用?PHP EventServiceProvider::boot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Foundation\Support\Providers\EventServiceProvider的用法示例。


在下文中一共展示了EventServiceProvider::boot方法的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::boot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。