Action $arguments returning empty in visible closure
I'm currently trying to access to
$arguments
data within a visible
closure but it's currently returning empty. Is it possible to access this variable here? I know $arguments
are being passed correctly because they work fine in modalDescription
This is an Action on a custom Livewire component on a custom page using Filament\Actions\Action
Function not working:
->visible(fn(array $arguments) => dd($arguments))
Result:
[] // app/Livewire/SubscriptionManagement.php:134
Function working:
->modalDescription(fn(array $arguments) => dd($arguments))
Result:
Any help would be appreciated.3 Replies
what is the goal?
I have a custom page that is used to manage subscriptions. On this page I have 3 tabs (my subscription, subscription management and payment methods)
On subscription management, it displays the 3 subscriptions to pick from - these are generated from the DB so I loop over those results to display the subscriptions, with features, price etc.
My goal here is to display a subscribe button (when no active subscription is present) and a switch subscription button (when there is an active one). To process the the correct subscription, I pass the subscription name through the arguments on the action. On the switch subscription button I only want to show available subscriptions so I want to hide the active switch subscription action only.
Something like this:
I have a workaround atm (provided from the bug report I sent through). Setting the action to a variable first and then calling that variable actually solves the issue.
eg.
I change this:
To this:
I'm quite new to filament so not sure if this is the best approach.
Now that I typed that out, I'm thinking it might be a better idea to create a component to display a single subscription component, and pass the name to that and have all the actions inside that.
$arguments will be available when the action is triggered. One way to handle this would be to create a property in your LW component and use it to control the action's visibility.