我发现我附加到电子邮件的 Pdf 在发送到 Mailtrap 中的电子邮件时没有显示,但它显示在原始数据部分。
我的控制器发送电子邮件的方法:
public function store(Request $request)
{
$this->validate($request, [
'name' => 'required',
'email' => 'required|email',
'quantity' => 'required|numeric|digits:1',
]);
if ($request->quantity > 5) {
toastr()->error('Only 5 tickets per booking is allowed');
return redirect()->back();
}
$a = 0;
$file = array();
while ($a < $request->quantity) {
$ordercode = substr(md5(time() . mt_rand(1, 1000000)), 0, 22);
$qrcodepath = 'assets/payments/qrcodes/'.str_slug($request->name).time().'.png';
$qrcode = QrCode::format('png')->size(400)->generate($ordercode, $qrcodepath);
$data["name"] = $request->name;
$data["email"] = $request->email;
$data["qrcode"] = $qrcodepath;
$data["ordercode"] = $ordercode;
$pdf = PDF::loadView('pdf.payment', $data); …Run Code Online (Sandbox Code Playgroud)