diff --git a/src/Database/Traits/Validation.php b/src/Database/Traits/Validation.php index 2467b176..be822a15 100644 --- a/src/Database/Traits/Validation.php +++ b/src/Database/Traits/Validation.php @@ -117,20 +117,21 @@ protected function getValidationAttributes() * * Example usage from TranslatableBehavior class: * - * $model->bindEvent('model.getValidationAttributes', function() { + * $model->bindEvent('model.getValidationAttributes', function ($attributes) { * $locale = $this->translateContext(); * if ($locale !== $this->translatableDefault) { - * $attributes = $this->model->getAttributes(); * return array_merge($attributes, $this->getTranslateDirty($locale)); * } * }); * */ - if ($attributes = $this->fireEvent('model.getValidationAttributes', [], true)) { - return $attributes; + + $attributes = $this->getAttributes(); + if (($validationAttributes = $this->fireEvent('model.getValidationAttributes', [$attributes], true)) !== null) { + return $validationAttributes; } - return $this->getAttributes(); + return $attributes; } /**