How to get selected record from table in header action?

I want to make header action that can collect the selected record link in bulkaction and send all value to custom view in new tab, i have search in doc but i still not find any clue, this is my code


->headerActions([
Action::make('Label')
->url(fn () => route('label', ['selected_records' => ['33', '34']]))
->openUrlInNewTab(),
])

i want selected_records is array from selected record like bulkaction,

Thank you
Solution
I have found a simple solution for this problem, I use notification for opening bulk action in new tab, this is my code

BulkAction::make('Label Barcode')
                    ->label('Label Barcode')
                    ->action(function ($records) {

                        $selectedRecordIds = $records->pluck('id')->implode(',');

                        Notification::make()
                            ->title('Apakah Anda yakin akan mencetak label ini?')
                            ->success()
                            ->persistent()
                            ->actions([
                                Action::make('ya')
                                    ->button()
                                    ->url(route('label', $selectedRecordIds), shouldOpenInNewTab: true)
                                    ->close(),

                            ])
                            ->send();
                    }),
Was this page helpful?