From 14883f9ebaac3714e07b396c19b3f6ec32747fac Mon Sep 17 00:00:00 2001 From: Mark Boessenkool Date: Wed, 2 Aug 2023 14:42:11 +0300 Subject: [PATCH] use Eloquent getArrayableItems() to return only the attributes that are visible --- src/CastsEnums.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CastsEnums.php b/src/CastsEnums.php index 3eb6250..c00ab64 100644 --- a/src/CastsEnums.php +++ b/src/CastsEnums.php @@ -81,7 +81,11 @@ public function setAttribute($key, $value) */ public function attributesToArray() { - return $this->addEnumAttributesToArray(parent::attributesToArray()); + return $this->getArrayableItems( + $this->addEnumAttributesToArray( + parent::attributesToArray() + ) + ); } /**