我想验证费用字段。如果 activity_code 值不是“SE”。它可以是任何值,但不是SE。
$rules = [
'cost' => 'required_if:activity_code,null',
'select_plans' => 'required_if:activity_code,SE',
];
答案 0 :(得分:0)
$rules = [
'cost' => 'required_unless:prf_activity_code,!=,SE',
'select_plans' => 'required_if:activity_code,SE',
];
答案 1 :(得分:0)
您可以使用:
$rules = [
'cost' => 'required_unless:activity_code,SE',
'select_plans' => 'required_if:activity_code,SE',
];
或
$rules = [
'cost' => 'required_if:activity_code,!=,SE',
'select_plans' => 'required_if:activity_code,SE',
];