Toggle afterStateUpdated not getting fired

public function form(Form $form): Form
{
return $form->schema([
Toggle::make('showUnmatched')
->label('Show')
->onColor('primary')
->offColor('gray')
->afterStateUpdated(function (?string $state, ?string $old) {
Log::debug($state);
Log::debug($old);
})
]);
}
public function form(Form $form): Form
{
return $form->schema([
Toggle::make('showUnmatched')
->label('Show')
->onColor('primary')
->offColor('gray')
->afterStateUpdated(function (?string $state, ?string $old) {
Log::debug($state);
Log::debug($old);
})
]);
}
I don't get anything logged when I use the afterStateUpdated method. I'dl ike to be able to save the state in the session but it doesn't seem to be getting fired at all. Suggestions? It's not tied to a field in my database, it's just a toggle I'm using to show/hide a section on the page.
Solution:
add ->live()
Jump to solution
2 Replies
Solution
Lara Zeus
Lara Zeus13mo ago
add ->live()
Jon Mason
Jon MasonOP13mo ago
duh...i'm dumb. thanks!
Want results from more Discord servers?
Add your server