const rules = {
address: 'required_if:needs_delivery'
}
// or
const rules = {
address: [
rule('required_if', 'needs_delivery')
]
}
The field is checked for required validation, when expected field exists.
const rules = {
address: 'required_if:needs_delivery'
}
// or
const rules = {
address: [
rule('required_if', 'needs_delivery')
]
}
For customized build, you can import this rule as follows.
import { requiredIf } from 'indicative/builds/validations'