I have this validation:
'target' => ['required', Rule::in(['ads', 'users',...])],
'expires_at' => 'required_if:target,!=,ads',
I need to make expires_at
is not required if the target
is ads
if the user chooses other options make expires_at
required again!
CodePudding user response:
You can try required_unless
.
'expires_at' => 'required_unless:target,ads',
Here is the documentation for that rule.