Skip to content

Commit 982f2e9

Browse files
committed
Fix callback rule not called when attribute is not required
1 parent 2f566bb commit 982f2e9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Validation.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ protected function validateAttribute(Attribute $attribute)
7373

7474
$attributeKey = $attribute->getKey();
7575
$rules = $attribute->getRules();
76+
77+
7678
$value = $this->getValue($attributeKey);
7779
$isEmptyValue = $this->isEmptyValue($value);
7880

@@ -84,11 +86,11 @@ protected function validateAttribute(Attribute $attribute)
8486
continue;
8587
}
8688

89+
$valid = $ruleValidator->check($value);
90+
8791
if ($isEmptyValue AND $this->ruleIsOptional($attribute, $ruleValidator)) {
8892
continue;
8993
}
90-
91-
$valid = $ruleValidator->check($value);
9294

9395
if (!$valid) {
9496
$isValid = false;

0 commit comments

Comments
 (0)