Call custom function after Toggle button changed (Outside Form)
What I want to achieve:
I'm trying to achieve a specific functionality with the toggle button which is on each member entry in my member list. The toggle is on the item itself and not inside the edit form. I want to call a custom function after the toggle is disabled again from an truthly state (enabled state).
What I did so far:
I tested the afterSave() hook in my EditMember.php file.
Where am I stuck
Since this afterSave hook is only called when I edit my member model within the form, the custom function within the afterSave hook is not getting called.
Thanks for your feedback guys.
6 Replies
this is toggleColumn right?
there is hooks for it
https://filamentphp.com/docs/3.x/tables/columns/toggle#lifecycle-hooks
Hmmm..
I tried to add the "afterStateUpdated" hook to my ToggleColumn, following the instructions in the docs. But it turns out, ToggleColumn doesn't even have that function.
Method Filament\Tables\Columns\ToggleColumn::afterStateUpdated does not exist.
open issue on github then
it dose exist
I guess you're on older version!?
Yes solve now by composer upgrade.
I was already on FilamentPhp v3.0.
DId not expect that this hook was introduced later.
Thank you all !