Skip to content

Commit

Permalink
fix(rollback) required_if and exclude_if validation
Browse files Browse the repository at this point in the history
i think you do not want to return early in these cases as @driesvints changed in this PR: laravel#37128
that PR broke using this validation for `null` values (e.g. checkboxes that are not checked) so you cannot use it like `exclude_if,otherfield,null`
  • Loading branch information
s4muel committed Nov 16, 2021
1 parent 23912e7 commit d662538
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/Illuminate/Validation/Concerns/ValidatesAttributes.php
Expand Up @@ -1509,10 +1509,6 @@ public function validateRequiredIf($attribute, $value, $parameters)
{
$this->requireParameterCount(2, $parameters, 'required_if');

if (! Arr::has($this->data, $parameters[0])) {
return true;
}

[$values, $other] = $this->parseDependentRuleParameters($parameters);

if (in_array($other, $values, is_bool($other) || is_null($other))) {
Expand Down Expand Up @@ -1612,10 +1608,6 @@ public function validateExcludeIf($attribute, $value, $parameters)
{
$this->requireParameterCount(2, $parameters, 'exclude_if');

if (! Arr::has($this->data, $parameters[0])) {
return true;
}

[$values, $other] = $this->parseDependentRuleParameters($parameters);

return ! in_array($other, $values, is_bool($other) || is_null($other));
Expand Down

0 comments on commit d662538

Please sign in to comment.