F
Filament14mo ago
Ehsan

Url generation from BulkAction

I want to generate Identity Cards for selected members from my MemberResource The identity cards will be visible to user before printing on a new page. I have created below bulk action to achieve the same. I have also created a custom page for this new route.
BulkAction::make('generate_id')
->label('Generate ID Card')
->requiresConfirmation()
->action(function ($livewire, Collection $records) {
$memberIds = implode(',', $records->pluck('id')->all());
$livewire->js("window.open('members/print-id-cards/{$memberIds}', '_blank')");
})
BulkAction::make('generate_id')
->label('Generate ID Card')
->requiresConfirmation()
->action(function ($livewire, Collection $records) {
$memberIds = implode(',', $records->pluck('id')->all());
$livewire->js("window.open('members/print-id-cards/{$memberIds}', '_blank')");
})
This works and the member IDs are passed to this custom route comma separated. But this exposes IDs to end user. I would like to convert the route to POST instead of GET so that I can pass the data to it. Please help with the same or suggest any other way of achieving this.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?