samedi 18 février 2017

Laravel 5.4 validation rules - optional, but validated if present;

I'm trying to create a user update validation through form, where I pass, for example 'password'=>NULL, or 'password'=>'newone';

I'm trying to make it validate ONLY if it's passed as not null, and nothing, not even 'sometimes' works :/

I'm trying to validate as :

Validator::make(array('test'=>NULL), array('test'=> 'sometimes|required|min:6'))->validate();

But it fails to validate... :/ ANy help would be appreciated.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2l6GcNd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire