Redirect with ->url() with bulk action?

I have a table and I would like to redirect to a route after selecting some records from the table.

I tried using ->url(), but it doesn't work, is it possible?

My code is this:

BulkAction::make('pdf')->label('Generate PDF')->icon('heroicon-o-document')
                    ->color('info')
                    ->url(fn ($records): string => route('step.pdf', ['steps' => $records]))
                    ->openUrlInNewTab()


Any ideas on how to resolve it? I tried with Action also returning route, but it was not possible.

Thanks.
Was this page helpful?