diff --git a/src/Base/Concern/HasAttributes.php b/src/Base/Concern/HasAttributes.php index 6cafdc4a9..840831ba1 100644 --- a/src/Base/Concern/HasAttributes.php +++ b/src/Base/Concern/HasAttributes.php @@ -335,13 +335,13 @@ protected function addCastAttributesToArray(array $attributes, array $mutatedAtt } if ($flags & Arrayable::SKIP_NULL) { - if (null === $attributes[$key]) { - unset($attributes[$key]); - } - if (is_array($attributes[$key])) { $attributes[$key] = Utils::filterNull($attributes[$key]); } + + if (null === $attributes[$key]) { + unset($attributes[$key]); + } } if ($flags & Arrayable::CASE_SNAKE || $flags & Arrayable::CASE_KEBAB || $flags & Arrayable::CASE_STUDLY) {