HirryBirry
HirryBirry
FFilament
Created by HirryBirry on 12/16/2024 in #❓┊help
ToggleButtons: Click to untoggle
Hi, I have a ToggleButtons-Component set up with an Enum-class. Is there a way to "untoggle" an already selected togglebutton. The desired result is that the delivery_method is set to null in the db.
ToggleButtons::make('delivery_method')
->hiddenLabel()
->options(DeliveryMethod::class)
->reactive()
->inline()
->afterStateUpdated(function (string $state, Retouche $record): void {
$record->update([
'delivery_method' => $state,
]);

// Optionally notify the user
Notification::make()
->title('Delivery method updated')
->success()
->send();
}),
ToggleButtons::make('delivery_method')
->hiddenLabel()
->options(DeliveryMethod::class)
->reactive()
->inline()
->afterStateUpdated(function (string $state, Retouche $record): void {
$record->update([
'delivery_method' => $state,
]);

// Optionally notify the user
Notification::make()
->title('Delivery method updated')
->success()
->send();
}),
5 replies