hi guys, im trying to use barryvdh/laravel-dompdf, everything works fine exept i cant load my data to the view to dynamically produce content, i keep getting 'Undefined variable: data'
here is my code:
public function certificate($id)
{
$data = RegisteredProduct::findOrFail($id);
$pdf = PDF::loadView('pdf.certificate', $data);
return $pdf->download('certificate.pdf');
}
@Fruty Yep. Just tested it and its working with compact. Or if you use an array $pd = $pdf->loadView('pdf', array('data' => 'test')); and in your view $data .