Skip to content

Commit

Permalink
Update Select2.php
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov authored Nov 25, 2020
1 parent dbfe450 commit e5d3364
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Select2.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,14 @@ protected function isRequired()
$validators = $this->model->getActiveValidators($this->attribute);
foreach ($validators as $validator) {
if ($validator instanceof RequiredValidator) {
return true;
if (is_callable($validator->when)) {
if (call_user_func($validator->when, $this->model, $this->attribute)) {
return true;
}
} else {
return true;
}

}
}
return false;
Expand Down

0 comments on commit e5d3364

Please sign in to comment.