From 9c3dd047266cc5ba79421fb8bae462daa1b5b6b3 Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 30 Jun 2022 15:13:25 +0200 Subject: [PATCH] Fix attributes with enums being excluded from audit --- src/Auditable.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Auditable.php b/src/Auditable.php index 531fdb2b..dbcf4ba7 100644 --- a/src/Auditable.php +++ b/src/Auditable.php @@ -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; } }