jeudi 9 janvier 2020

Laravel: Validate field only when the value changed

Some form fields in my laravel 5.5 application have validation rules that run against a remote API and take quite some time. I would thus only want to run these expensive checks when the field value changes (is different from the value currently stored in the model).

Is there something that implements this already, e.g. as a rule similar to sometimes?

I would image it like this: only_changed|expensive_validation|expensive_validation2. The latter rules would only be executed when the field value has changed.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire