Skip to content

Commit

Permalink
fix(model): fix error when unsetting property using skip_null
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Nov 6, 2023
1 parent 7a38a6d commit e6bf984
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Base/Concern/HasAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e6bf984

Please sign in to comment.