I have 3 fields 'account_name','billable_option' and 'billable_option_yes'
'billable_option'
is required if 'billable_option_yes'
is not filled and 'billable_option_yes'
is required if 'billable_option'
is not filled
and I want to check both field is not required if 'account_name' value is 0 I want to combine the validation required_unless:account_name,0
if($account!=0){ } not working
$account=$request->account_name;
if($account!=0){ //not working
$this->validate($request,[
'billable_option' => 'required_without:billable_option_yes',
'billable_option_yes' =>'required_without:billable_option',
],$messages);
}
$messages=[
'billable_option.required_without'=>'The Billable is Required',
'billable_option_yes.required_without'=>'The Billable optoion is Required',
];
$this->validate($request,[
...
'billable'=>'required_unless:account_name,0', //fourth field working fine
..
],$messages);
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zGavm3
via IFTTT
Aucun commentaire:
Enregistrer un commentaire