$created array
包含电子邮件值和名称等。 return $this->view('emails.created');
工作正常,但我想使电子邮件发件人是$created->email
或这样的控制器Mail::to('email')->from($created->email)->send(new Created($created));
。但是两种方法都不起作用。如何处理app\Mail\Created.php
文件中的此变量数组?我需要一些帮助。
class Created extends Mailable
{
use Queueable, SerializesModels;
/**
* The created instance.
*
* @var created
*/
public $created;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($created)
{
$this->created = $created;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->from($created->email)->view('emails.created');
}
}
答案 0 :(得分:0)
以此更改您的构建功能并进行检查。还要确保在数组中传递email参数。
public function build()
{
return $this->from($this->created->email)->view('emails.created');
}