Skip to content

Commit

Permalink
Mutator calls other mutators before passing the value to the enum con…
Browse files Browse the repository at this point in the history
…structor
  • Loading branch information
fulopattila122 committed Mar 11, 2022
1 parent a03b9d6 commit 86a667c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/CastsEnums.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 86a667c

Please sign in to comment.