dimanche 4 octobre 2015

Laravel: How to use required_if to match value

I have a hidden field:

{!! Form::hidden('number',2,['id'=>'number_of_experts']) !!}

In my Controller's Post Method I want to check that if value is 2 then it gives validation message. This is I have done but not working.

$total = 2;
$rules['number'] = 'required_if:number,'.$total;

The rule is just being by passed. What am I doing wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire