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.
The loadView method you are using is going to use the extract method before passing the data to the views. This method extracts all the array elements, and creates variables for them based on the key of the element
This means that your array keys are going to be your variable names, ie $name and not $data->name. This is fairly standard in laravel, for example when using Blade Views.
http://php.net/manual/en/function.extract.php
Use compact('data')
instead of $data
.
Example:
$pdf = \PDF::loadView('productType.invoice', compact('data'));