How to give a validation on if condition like in my project case there are two inputs one is deal type and one is event name .so i have to give a condition like if deal type is single then i have to validate that event name otherwise no.
Here is my view :
<select name="deal_type">
<option value="">--Select--</option>
<option value="annual">Annual</option>
<option value="single">Single</option>
</select>
<select name="eventname">
<option value="">--Select--</option>
<option value="event1">Event1</option>
<option value="event2">event2</option>
</select>
my validation request.php :
public function rules()
{
return [
'deal_type'=>'required',
'eventname'=>'required_if:deal_type,single'
];
}
I was trying something like above but it is not working .Any suggestions please.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire