dimanche 6 mars 2016

Use 'different' and 'sometimes' rule simultaneously in laravel form validation

I am using a form that dynamically generates text fields. I want to validate that if that text field exists then it must be required and also no two text fields have same value.

$this->validate($request,array(
        'question' => 'required|min:5',
        'tag1' => 'sometimes|required|different:tag2,tag3',
        'tag2' => 'sometimes|required|different:tag1,tag3',
        'tag3' => 'sometimes|required|different:tag1,tag2',
        ));

I am using this above code, but if I have added only tag1, it is showing error

The tag1 and tag2 must be different.



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

Aucun commentaire:

Enregistrer un commentaire