【发布时间】:2017-08-29 06:36:56
【问题描述】:
我遇到了一个非常简单的问题,因为我是 Laravel 的新手。我的问题是如何在邮件中回显申请人的姓名?
代码如下:
public function toMail($notifiable)
{
$name = $notifiable->name;
return (new MailMessage)
->from('testing@gmail.com', 'Test')
->greeting('Hello!')
->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.');
}
输出应该是“你好!(这里是申请人姓名)”,当我尝试dd它时,它给了我重置密码的申请人的正确输出。
但是当我将它包含在我的代码中时:
->greeting('Hello! $name')
当我收到电子邮件时,它给了我“Hello!$name”,这是逐字记录的代码。
【问题讨论】:
-
试试
->greeting('Hello!' .$name) -
讨论到此结束。太感谢了!欣赏!
标签: php laravel email laravel-5 laravel-5.4