I am using maatwebsite Excel Laravel Package. Using same Export Class can I use View to PDF import and Model to Excel;
To PDF Export I want to use View File
public function view(): View
{
return view('exports.invoices', [
'invoices' => Invoice::all()
]);
}
return Excel::download(new InvoicesExport, 'invoices.pdf', \Maatwebsite\Excel\Excel::MPDF);
Incase of Excel
return Excel::download(new InvoicesExport, 'invoices.xls', \Maatwebsite\Excel\Excel::XLS);
No View File