I have 2 fields to check validation...
parent
tag
I want something like this:
if(parent == 0)
return 'tag is required';
else
return 'tag can be nullable';
I try something like this but it is wrong:
'parent' => 'nullable|numeric',
'tags' => 'required_with:parent=0|array|max:8',
Use the required_if
rule.
The field under validation must be present and not empty if the anotherfield field is equal to any value.
'parent' => 'nullable|numeric',
'tags' => 'required_if:parent,0|array|max:8',