/** * 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) { try { $user->sendWelcomeNotification($password); } catch (Exception $e) { return $listener->profileCreatedWithoutNotification(); } return $listener->profileCreated(); }
/** * 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(); }