Level 102
Are you sure that is the code that is erroring? You are returning twice, and there is {} on random lines ? And you are not passing anything as the second parameter to loadView()
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
TypeError Argument 2 passed to Barryvdh\DomPDF\PDF::loadView() must be of the type array, object given, called in C:\xampp\htdocs\new-temp\vendor\barryvdh\laravel-dompdf\src\Facade\Pdf.php on line 56 http://127.0.0.1:8000/admin/generate_certificate/11
$registration = DB::table('registrations')->find($id);
$pdf = PDF::loadView('admin.registrations.generate_certificate');
$pdf->setPaper('A4', 'landscape');
return $pdf->stream('pdfview.pdf');
{
return view('admin.registrations.generate_certificate', compact('registration'));
}
Please or to participate in this conversation.