DOMPDF loadView() error - undefined variable: data

后端 未结 2 992
旧时难觅i
旧时难觅i 2021-01-17 18:50

I\'m currently trying to incorporate the DOMPDF Wrapper for Laravel into my project, however I\'m having troble figuring out how to pass a variable into the PDF template.

2条回答
  •  滥情空心
    2021-01-17 19:26

    Use compact('data') instead of $data.

    Example:

    $pdf = \PDF::loadView('productType.invoice', compact('data'));
    

提交回复
热议问题