Jaa*_*ayz 1 php email laravel laravel-5 laravel-5.4
当用户将忘记密码重置链接发送到他/她的电子邮件时,我想让我的邮件更加详细。这是收到重置密码链接时的图片示例。
我想在这里添加一些细节,Hello应该是Hello!(此处为用户名)
这是我在SendsPasswordResetEmails.php 中添加的代码
public function sendResetLinkEmail(Request $request)
{
$this->validateEmail($request);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$response = $this->broker()->sendResetLink(
$request->only('email')
);
$applicant_name = Applicant::where('email', $request->email)->get()->value('name');
return $response == Password::RESET_LINK_SENT
? $this->sendResetLinkResponse($response)
: $this->sendResetLinkFailedResponse($request, $response);
}
Run Code Online (Sandbox Code Playgroud)
它应该将数据传递给app\Notifications\ApplicantResetPasswordNotification.php
public function toMail($notifiable)
{
return (new MailMessage)
->from('vcc3dummy@gmail.com', 'CCV3')
->greeting('Hello! Applicant Name') // Applicant name pass here
->line('You are receiving this email because we received a password request for your account.')
->action('Click here to Reset Password', route('applicant.reset', $this->token))
->line('If you did not reset your password, no further action is required.');
}
Run Code Online (Sandbox Code Playgroud)
寻求有关如何传递数据或如何查询数据的帮助。如果有人可以帮助我,将不胜感激 提前致谢。
在您ApplicationResetPasswordNotification.php可以$notifiable按如下方式使用变量:
public function toMail($notifiable)
{
return (new MailMessage)
->from('vcc3dummy@gmail.com', 'CCV3')
->greeting('Hello!' . $notifiable->name) // Applicant name
...
}
Run Code Online (Sandbox Code Playgroud)
如果这对您有用,请标记为答案!