Exclude TextInput in Form from saving in database

Hi! I have following Text input:
TextInput::make('checkServicePIN')
->label('Service-PIN')->password()->autocomplete(false)->columns(1)
->suffixAction(
Action::make('checkServicePIN')
->icon('heroicon-m-check-circle')
->action(function (?Model $record, $state, Set $set) {
$state == $record->service_pin ? $record->lastPINentry = true : $record->lastPINentry = false;
$record->save();
})
),
Placeholder::make('lastPINentry')
->content(fn (Order $record): string => $record->lastPINentry == 1 ? new HtmlString('right') : new HtmlString('wrong')),
TextInput::make('checkServicePIN')
->label('Service-PIN')->password()->autocomplete(false)->columns(1)
->suffixAction(
Action::make('checkServicePIN')
->icon('heroicon-m-check-circle')
->action(function (?Model $record, $state, Set $set) {
$state == $record->service_pin ? $record->lastPINentry = true : $record->lastPINentry = false;
$record->save();
})
),
Placeholder::make('lastPINentry')
->content(fn (Order $record): string => $record->lastPINentry == 1 ? new HtmlString('right') : new HtmlString('wrong')),
So basically if I enter the pin, it tells me whether it is correct or not. This functionality is working. But below this I have my regular Form. And as soon as I want to save the Form it tells me that the column checkServicePIN does not exist. This is right but I do not want to save the entered pin. It should only check it with the one that is already stored in the database and save the result in the column lastPINentry. The Placeholder shows this result. How can I exclude the text input from beeing saved to the databse?
Solution:
->dehydrated(false)
Jump to solution
2 Replies
Solution
awcodes
awcodesβ€’11mo ago
->dehydrated(false)
_𝕰𝖋x
_𝕰𝖋xOPβ€’11mo ago
thanks πŸ™
Want results from more Discord servers?
Add your server