/** * Send the password reminder e-mail. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @param string $token * @param \Closure|null $callback * * @return \Orchestra\Contracts\Notification\Receipt */ public function emailResetLink(RemindableContract $user, $token, Closure $callback = null) { // We will use the reminder view that was given to the broker to display the // password reminder e-mail. We'll pass a "token" variable into the views // so that it may be displayed for an user to click for password reset. $data = ['user' => $user instanceof Arrayable ? $user->toArray() : $user, 'token' => $token]; $message = Message::create($this->emailView, $data); return $this->mailer->send($user, $message, $callback); }
/** * Notify user. * * @param \Orchestra\Contracts\Notification\Recipient $recipient * @param \Illuminate\Database\Eloquent\Model $user * @param array $changes * @param array $config * * @return bool */ public function notify(Recipient $recipient, Model $user, array $changes, array $config = []) { if (!$this->mailer instanceof Notification) { throw new RuntimeException("Mailer need to be an instance of Orchestra\\Contracts\\Notification\\Notification."); } if (!!$this->unguarded || empty($changes)) { return false; } $data = ['user' => $user instanceof Arrayable ? $user->toArray() : $user, 'changes' => $changes]; $message = Message::create($config['email'], $data); return $this->mailer->send($recipient, $message); }
/** * Send new registration e-mail to user. * * @param \Orchestra\Contracts\Foundation\Listener\Account\ProfileCreator $listener * @param \Orchestra\Model\User $user * @param string $password * * @return mixed */ protected function notifyCreatedUser(Listener $listener, Eloquent $user, $password) { // Converting the user to an object allow the data to be a generic // object. This allow the data to be transferred to JSON if the // mail is send using queue. $memory = Foundation::memory(); $site = $memory->get('site.name', 'Orchestra Platform'); $data = ['password' => $password, 'site' => $site, 'user' => $user instanceof Arrayable ? $user->toArray() : $user]; $subject = trans('orchestra/foundation::email.credential.register', ['site' => $site]); $message = Message::create(config('auth.register.email', 'emails.auth.register'), $data, $subject); $receipt = $user->notify($message); if ($receipt->failed()) { return $listener->profileCreatedWithoutNotification(); } return $listener->profileCreated(); }