我有一个可维护的电子邮件模板页面。 我使用ck编辑器添加文本。 我有数据要看
所以在ckeditor中我将写如下内容
尊敬的客户,
您的申请已被路由批准详细信息:
名称:{{$DATA->NAME}},
电话:{{$DATA->电话}},
这将保存到列text_email中
并且我在controller中声明$data
但是当我发送电子邮件时,输出将显示{{$data->name}}
,而不是$data->name
的值;
null
public function send_email($id){
$data=Data::where('id',$id)->first();
$template_email = PrMaintenableEmail::where('email_for', 'ME05')->limit('1')->first();
Mail::send('mail.mail', compact('temp_email','data'), function ($message) use ($template_email ) {
$message->from(xx, xx);
$message->subject($template_email ->subject);
$message->to('xxx', 'xxx');
});
}
null
在邮件刀片中
{!!$template_email->text_email!!}
那么,在$template->text_email中有{{$data}},如何显示$data值呢?
使用数组
而不是压缩
Mail::send('mail.mail',['temp_email'=>$temp_email,'data'=>$data], function ($message) use ($template_email ) {