F
Filament12mo ago
Masea

textinputcolumn lifecycle hook stop the action

TextInputColumn::make('sale_price')
->rules(['min:0', 'numeric'])
->type('number')
->beforeStateUpdated(function ($action, $record, $state) {
if ($state >= $record->price) {

$action->halt();
}
}),
TextInputColumn::make('sale_price')
->rules(['min:0', 'numeric'])
->type('number')
->beforeStateUpdated(function ($action, $record, $state) {
if ($state >= $record->price) {

$action->halt();
}
}),
I have a table colum like above in my project. Inside beforeStateUpdated, can I halt the process so it won't save the value to the database? The code doesn't work by the way as $action parameter is not resolved. Thanks
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server