diff --git a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php index 8f88aa2cd8df..ef71f0fdc576 100644 --- a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php +++ b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -1554,7 +1554,7 @@ public function parseDependentRuleParameters($parameters) $values = array_slice($parameters, 1); - if (is_bool($other)) { + if ($this->shouldConvertToBoolean($parameters[0]) || is_bool($other)) { $values = $this->convertValuesToBoolean($values); } elseif (is_null($other)) { $values = $this->convertValuesToNull($values); @@ -1563,6 +1563,19 @@ public function parseDependentRuleParameters($parameters) return [$values, $other]; } + /** + * Check if parameter should be converted to boolean. + * + * @param $parameter + * @return bool + */ + protected function shouldConvertToBoolean($parameter) + { + $rules = Arr::get($this->rules, $parameter, []); + + return in_array('boolean', $rules); + } + /** * Convert the given values to boolean if they are string "true" / "false". *