Inheritance: extends Illuminate\Support\ServiceProvider
Ejemplo n.º 1
0
 /**
  * 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));
     });
 }
Ejemplo n.º 2
0
 /**
  * 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');
 }
Ejemplo n.º 3
0
 /**
  * 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());
 }
Ejemplo n.º 4
0
 /**
  * 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
     });
 }
 public function boot()
 {
     // DispatcherContract $events
     // $events
     parent::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();
             }
         }
     });
 }
 /**
  * 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');
     }
 }
 /**
  * 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();
     });
 }
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher $events
  *
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     $response = new ResponseBuilder(new JsonResponse());
     /*
     |--------------------------------------------------------------------------
     | Events
     |--------------------------------------------------------------------------
     |
     | These are events used to return custom JSON response when error occurs
     | using JWT Library. This type of event listening is compatible with
     | Laravel 4.* that JWT Library currently supports.
     |
     */
     Event::listen('tymon.jwt.invalid', function ($exception) {
         throw $exception;
     });
     Event::listen('tymon.jwt.expired', function ($exception) {
         throw $exception;
     });
     Event::listen('tymon.jwt.absent', function () use($response) {
         $exception = new TokenAbsentException();
         return $response->exception($exception);
     });
     Event::listen('tymon.jwt.user_not_found', function () use($response) {
         $exception = new TokenInvalidException();
         return $response->exception($exception);
     });
 }
Ejemplo n.º 10
0
 /**
  * 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);
     });
 }
Ejemplo n.º 11
0
 /**
  * Bootstrap the application services.
  *
  * @param DispatcherContract $events
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     $this->bootConfig();
     $this->bootViews();
     $this->bootMigrations();
 }
Ejemplo n.º 12
0
 /**
  * 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);
     }
 }
Ejemplo n.º 13
0
 /**
  * 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('*', function ($message) {
         //
     });
 }
 /**
  * Register any events for your application.
  *
  * @return void
  */
 public function boot()
 {
     parent::boot();
     $this->registerDeleteEvents();
     $this->registerCreateEvents();
     //
 }
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Feedback::created(function ($item) {
         Cache::tags('feedbacks')->flush();
         $this->dispatch(new SentenceProcessing($item));
     });
     Feedback::updated(function ($item) {
         Cache::tags('feedbacks')->flush();
     });
     Feedback::deleted(function ($item) {
         Cache::tags('feedbacks')->flush();
     });
     Comment::saved(function ($item) {
         Cache::tags('comments')->flush();
     });
     Comment::saved(function ($item) {
         Cache::tags('comments')->flush();
     });
     Sentence::saved(function ($item) {
         if ($item->feedback) {
             $item->feedback->calculateProbabilities();
         }
     });
 }
 /**
  * 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) {
         //
     });
 }
 /**
  * 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();
         }
     });
 }
Ejemplo n.º 18
0
 /**
  * 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('mailer.sending', function ($message) {
         debug('Email sent "' . $message->getSubject() . '" to "' . array_keys($message->getTo())[0] . '".', ['message' => $message->toString()]);
     });
 }
Ejemplo n.º 19
0
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Contact::updating(function (Contact $contact) {
         if ($new_values = $contact->getDirty()) {
             if (isset($new_values['status'])) {
                 $message = \Lang::get('contact.status_update.' . $new_values['status']);
                 if ($contact->hasAttribute('change_status_comment')) {
                     if ($comment = $contact->getAttribute('change_status_comment')) {
                         $message .= PHP_EOL . $comment;
                     }
                     unset($contact->change_status_comment);
                 }
             } else {
                 $values = [];
                 $old_values = $contact->getOriginal();
                 foreach ($new_values as $key => $value) {
                     $values[] = [$key, $old_values[$key], $value];
                 }
                 $message = 'json:' . json_encode($values);
             }
             $log = new ContactLog();
             $log->contact_id = $contact->id;
             $log->user_id = \Auth::getUser()->id;
             $log->comment = $message;
             $log->save();
         }
     });
 }
Ejemplo n.º 20
0
 /**
  * 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();
     });
 }
Ejemplo n.º 21
0
 /**
  * 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']);
 }
 /**
  * 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));
         });
     }
 }
Ejemplo n.º 23
0
 /**
  * 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('mailer.sending', function ($message) {
         // for debugging
     });
 }
Ejemplo n.º 24
0
 /**
  * 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('App\\Events\\sendemail', function ($event) {
         \Log::info("test sendemail in 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', function ($user, $remember) {
         // Record user login
         Activity::create(['subject_type' => 'User', 'subject_id' => '', 'event' => 'Logged In', 'user_id' => $user->id, 'ip' => Request::server('REMOTE_ADDR')]);
     });
 }
 /**
  * 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', function ($user, $remember) {
         $user->last_login_at = Date('Y-m-d H:i:s');
         $user->save();
     });
 }
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     // Fired on logouts...
     $events->listen('auth.logout', function ($user) {
         return redirect('login');
     });
 }
Ejemplo n.º 28
0
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     \App\Device::observe('App\\Observers\\DeviceObserver');
     \App\DeviceType::observe('App\\Observers\\DeviceTypeObserver');
     \App\DeviceLocation::observe('App\\Observers\\DeviceLocationObserver');
     \App\User::observe('App\\Observers\\UserObserver');
 }
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     //创建新用户时候顺便创建用户信息
     \Pianke\Models\User::created(function ($user) {
         event(new \Pianke\Events\UserCreate($user));
     });
 }
Ejemplo n.º 30
-1
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     \DB::listen(function ($sql, $bindings, $time) {
         var_dump($sql);
     });
     //
 }