php - 如何将变量传递给降价?laravel 邮件
问题描述
我正在使用MailMessage
将邮件消息发送到 mailtrap,并且我传递了一个变量email
.
我的问题是它无法识别我在降价中传递的变量。它在下面返回错误
Facade\Ignition\Exceptions\ViewException:未定义变量:电子邮件(查看:/var/www/resources/views/ema...
有人知道传递和获取变量 from-to markdown 的正确方法是什么?
这是我的代码
return (new MailMessage)
->greeting('hello')
->line('Innerline sample')
->action('Reset Button', 'http://localhost:3002/reset?sample=gibor213kg')
->line('sample')
->markdown('emails.reset')
->with('email', 'orange@gmail.com');
这是我的降价外观
@component('mail::layout', ['email' => $emaill])
//more codes here
{{ $email }}
//more codes here
@endcomponent
解决方案
将变量作为第二个参数传递。
return (new MailMessage)
->greeting('hello')
->line('Innerline sample')
->action('Reset Button', 'http://localhost:3002/reset?sample=gibor213kg')
->line('sample')
->markdown('emails.reset', [
'email' => 'orange@gmail.com',
]);
推荐阅读
- ios - 如何确认 App Store 将尊重我的最低 iOS 版本?
- excel - 使用 Excel VBA 从其他工作表更新成本中心
- realm - 如何查询 Realm DB Browser?
- reactjs - React - 通过存在对象属性覆盖状态
- azure-devops - 从 az ml cli 运行 id
- java - 部署为war时是否需要spring boot应用程序的“main”方法
- html - 视频无法在 chrome 中播放或自动播放,甚至静音 - 有时是,有时不是
- syntax - 匹配借来的枚举 - 为什么这种语法等效?
- sql-server - 如何使用 Visual Studio 2019 调试 CLR 数据库对象(存储过程)
- spring-integration - 如何从上传文件到 sftp 获得响应?