How to pass an argument to a custom table actions
how to pass arguments to a custom action, search the entire documentation did see anything mentioned regarding this
Solution:Jump to solution
So you want:
```php
Tables\Actions\EditAction::make(),
\Filament\Tables\Actions\Action::make('Generate QR Codes')...
8 Replies
What are you trying to do.
is this in the action for submitting the action,or using it within somewhere else within the action like form
I want to allow users to generate QR codes for all tickets related to a specific event directly from the EventResource index page. The QR codes will:
Be unique to each ticket.
Be saved as images in storage.
Be bundled into a downloadable ZIP file for the user.
The action button will:
Trigger the generation of QR codes.
Handle the association with the event automatically via the passed id.
Solution
So you want:
the action is on single row of items in the table, meaning that like and edit link on the table to links to a particular resource, the action also generates tickets for a single event
Thats what the above would do... You just need to code in the ticket generator
this is how i wrote it initially
You are wanting tickets per event. Conditiong the CardTicket to use $this->id and put it in your model as a function which returns the zip file, then on streaming in the action delete after download.
and thank you, you got me somewhere, the main issue was of passing the argument to the function used to generate the qr code, now that i can write the function inside the action its self pretty much solves my problem