Skip to content

Commit

Permalink
Fix attributes with enums being excluded from audit
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz committed Jun 30, 2022
1 parent 2317a5e commit 9c3dd04
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Auditable.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ protected function resolveAuditExclusions()

foreach ($attributes as $attribute => $value) {
// Apart from null, non scalar values will be excluded
if (is_array($value) || (is_object($value) && !method_exists($value, '__toString'))) {
if (
is_array($value) ||
(is_object($value) &&
!method_exists($value, '__toString') &&
!($value instanceof \UnitEnum))
) {
$this->excludedAttributes[] = $attribute;
}
}
Expand Down

0 comments on commit 9c3dd04

Please sign in to comment.