Form Validation inside Action
Hi, I'm trying to add a simple form validation inside my 'delete action'.
I want to show a random number and the user to introduce the same to delete the record.
I've tried changing the modal view, but it justs keeps dee¡leting everything no matter the form: <
I want to show a random number and the user to introduce the same to delete the record.
I've tried changing the modal view, but it justs keeps dee¡leting everything no matter the form: <
Tables\Actions\Action::make('Delete')
->label('Eliminar')
->color('danger')
->modalContent(fn (Pedido $record,): View => view(
'filament.actions.deletePedido',
['record' => $record, 'aleatorio' => rand(1000, 9999)],
))
->modalSubmitActionLabel('Eliminar')
->modalCancelActionLabel('Cancelar')
->color('danger')
->action(function (Pedido $record, Request $request) {
$userNum = $request->input('userNum');
error_log($userNum."el del susuario");
$aleatorio = $request->input('aleatorio');
error_log($aleatorio."el del susuario");
if ($userNum === $aleatorio) {
error_log("Se borra");
}
else{
error_log(" No Se borra");
}
})>