How do I do Print in Bulkaction?

For certain columns of my selected records, I need to take a print action with a note on each page, but how can I do it?
9 Replies
toeknee
toeknee3mo ago
Not sure, can you explain more?
Mehmet K.
Mehmet K.OP3mo ago
In fact, when I click on the button for the records I have selected in the bulk action, I want to open a print page as if I pressed with ctrl p, but there will be records in it that I want.
toeknee
toeknee3mo ago
You'll need to pass in the URL with a bunch of the ID's and open a new page with them
->url(fn($records) => 'myurl?ids=' . $record->pluck('id')->implode(','))
->url(fn($records) => 'myurl?ids=' . $record->pluck('id')->implode(','))
Mehmet K.
Mehmet K.OP3mo ago
Tables\Actions\BulkAction::make('Export')
->icon('heroicon-m-arrow-down-tray')
->deselectRecordsAfterCompletion() ->url(fn($records) => 'pdf.generate?ids=' . $records->pluck('id')->implode(','))->openUrlInNewTab(),
Tables\Actions\BulkAction::make('Export')
->icon('heroicon-m-arrow-down-tray')
->deselectRecordsAfterCompletion() ->url(fn($records) => 'pdf.generate?ids=' . $records->pluck('id')->implode(','))->openUrlInNewTab(),
Call to a member function pluck() on null I don't think the records are coming in
toeknee
toeknee3mo ago
Possibly yeah, It was an assumption... Let me check does it have to open in a new tab?
Mehmet K.
Mehmet K.OP3mo ago
As long as it's open, it doesn't matter.
toeknee
toeknee3mo ago
no problem then
Tables\Actions\BulkAction::make('Export')
->icon('heroicon-m-arrow-down-tray')
->action(fn($records) => redirect('pdf.generate?ids=' . $records->pluck('id')->implode(','))),
Tables\Actions\BulkAction::make('Export')
->icon('heroicon-m-arrow-down-tray')
->action(fn($records) => redirect('pdf.generate?ids=' . $records->pluck('id')->implode(','))),
Mehmet K.
Mehmet K.OP3mo ago
thank you it's working
jepewsykes
jepewsykes3mo ago
i do it on session put and get in controller generating pdf
Want results from more Discord servers?
Add your server