Open aragornq opened 1 year ago
Read laravel documentation That is not how the data is sent to the views
that should be
$data = User::all();
$pdf = Pdf::loadView('users/pdf', compact('data'));
I had the same problem, this works for me:
$pdf = Pdf::loadView('users/pdf', ['data'] => $data);
$data = User::all()->toArray(); $pdf = Pdf::loadView('users/pdf', $data); return $pdf->download('usersPDF.pdf'); in pdf.blade.php which is the view receives $data you can see error (undefined variable $data) . could you help me about it ?
this is balde file:
@extends('index') @section('content')
@endsection