Vishal Thakkar
How to get selected records in PDF using filament 3
Acion in filament resource
Tables\Actions\Action::make('Download Pdf')
->icon('heroicon-o-code-bracket-square')->url('/pdf')
Routes
Route::any('/pdf', [ProductsController::class, 'index'])->name('products.index');
// Function in contorller
public function index()
{
$product = Products::orderBy('position','asc')->get();
$pdf = pdf::loadView('catalogpdf',array('product' => $product))->setPaper('letter');
return $pdf->download('catalog.pdf');
}
64 replies
How to get selected records in PDF using filament 3
i am getting selected records with the help of this in bulk action
Tables\Actions\DeleteBulkAction::make()->before(
function (Collection $records) {
$records->each(function (Products $record) {
// i can get single record through this
});
}),
])
with this i am able to access single record i cannot pass an array to routes
64 replies
How to get selected records in PDF using filament 3
@Lucky0
This code i am using for generating all records PDF and its working fine
/* Code in controller function start /
$product = Products::orderBy('position','asc')->get();
$pdf = pdf::loadView('catalogpdf',array('product' => $product))->setPaper('letter');
return $pdf->download('catalog.pdf');
/ Code in controller ends */
and i am using this action
Tables\Actions\Action::make('Download Pdf')
->icon('heroicon-o-code-bracket-square')->url('/pdf')
64 replies
How to get selected records in PDF using filament 3
@Lucky0 $selected = $livewire->getSelectedTableRecords(); through this i can get selected records but i can use the records one by one. i cannot pass the array to route. and livewire is not allwowing to generate PDF as i am using domPDF package
64 replies