以下是我的邮件功能: 如何将数组传递给邮件功能?
public function mail(Request $request , $id) {
$data=[
'owner'=>MyRoom::where('id',$id)->get(),
'data2'=>$request->all(),
];
Mail::send('emails.mail' , $data, function($message) use ($data){
$message->to($owner->created_by->email , $owner->created_by->name)
->subject('Room showing Request From OpenRoomList');
$message->from('regmibipin13@gmail.com','OpenRoomList');
});
echo "Email Send check your inbox";
}
答案 0 :(得分:0)
首先,不要执行get会为您提供集合的操作,而是这样做:
'owner' => MyRoom::find($id);
在resources/emails/mail.blade.php
刀片文件中,您可以使用$owner
和$data2
之类的blde语法直接使用{{ $owner->somecolumn }}
和{{ $data2['somefield'] }}
变量