I have custom validation rule in my controller:
$this->validate($request, [
'currency' => [
'required',
'numeric',
'min:0',
'max:7'
],
'price' => [
'nullable',
"required_if:currency, !=, 0",
'numeric',
'min:1',
'max:1000000'
],
], $messages);
Why work in required_if:currency, ==, 0
and not work in this required_if:currency, !=, 0
case?
In my case price
field required only when currency
field value not equal to 0
I tired also:
required_unless,currency,0
required_unless:currency,0
currency => gt:12
– Gomphosis