I have a problem in my code when i want to do export html to pdf feature for my table data with domPdf Laravel 9
When i try to click the feature i get this error
Call to undefined method Illuminate\Database\Query\Builder::getIterator()
My Controller -> on my controller i add this code
<?php
use PDF;
public function export(Request $request){
$fotoOutcomes= new FotoOutcomeCollection(FotoOutcome::with('user','outcomeCategory','paymentMethod')->select('name','cost','date','pcs'));
$pdf = PDF::loadView('FotoOutcomeExport/FotoOutcomeExport', compact('fotoOutcomes'));
return $pdf->download('Foto-Outcome.pdf');
}`
My config app -> on my config i add this code
'providers' => [
Barryvdh\DomPDF\ServiceProvider::class
],
'aliases' => Facade::defaultAliases()->merge([
"PDF"=>Barryvdh\DomPDF\Facade::class
])->toArray(),`
i am trying to do export html to pdf and my expectation is that when the Photo Outcome Print feature is clicked, the data table in the controller request will be made a pdf