diff --git a/Changelog.md b/Changelog.md index 1a8ec68..40bc78e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,12 @@ # Changelog ### Konekt Enum Eloquent +## Unreleased +##### 2022-03-XX + +- Changed casting behavior so that other mutators defined on field are also + being called before passing the value to the enum constructor + ## 1.8.0 ##### 2022-03-10 diff --git a/src/CastsEnums.php b/src/CastsEnums.php index d483b60..3eb6250 100644 --- a/src/CastsEnums.php +++ b/src/CastsEnums.php @@ -30,7 +30,7 @@ public function getAttributeValue($key) if ($this->isEnumAttribute($key)) { $class = $this->getEnumClass($key); - return $class::create($this->getAttributeFromArray($key)); + return $class::create(parent::getAttributeValue($key)); } return parent::getAttributeValue($key);