Exemple #1
0
 /**
  * Execute the job.
  *
  * @param  Mailer $mailer
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     Clockwork::startEvent('mail.account_created', 'Mail account created.');
     $mailer->send('mails.accountCreated', ['username' => $this->user->username], function ($message) {
         $message->to($this->user->email, $this->user->username)->subject('Account created');
     });
     Clockwork::endEvent('mail.account_created');
 }
Exemple #2
0
 /**
  * Execute the job.
  *
  * @param  Mailer $mailer
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     Clockwork::startEvent('mail.lost_password', 'Mail account created.');
     $mailer->send('mails.lostPassword', ['token' => $this->token, 'username' => $this->user->username], function ($message) {
         $message->to($this->user->email, $this->user->username)->subject('Lost password');
     });
     Clockwork::endEvent('mail.lost_password');
 }
Exemple #3
0
 /**
  * @param ValidationInterface $model
  *
  * @throws ModelNotValid
  */
 protected function validate(ValidationInterface $model)
 {
     $timelineKey = uniqid('validation_');
     Clockwork::startEvent($timelineKey, 'Validation of model ' . get_class($model));
     $modelArray = $model->toArray();
     // add hiddens fields to the array for validation
     foreach ($model->getHidden() as $hidden) {
         $modelArray[$hidden] = $model->{$hidden};
     }
     $validator = Validator::make($modelArray, $model->getRules());
     if ($validator->fails()) {
         Clockwork::endEvent($timelineKey);
         $model->setErrors($validator->errors());
         throw new ModelNotValid($validator->errors());
     }
     Clockwork::endEvent($timelineKey);
 }