Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
lav45 committed Oct 1, 2024
1 parent f4f0544 commit f7fc42d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/SerializeBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ public function beforeSave()
public function afterSave(AfterSaveEvent $event)
{
foreach ($this->data as $key => $_) {
$attribute = $this->attributes[$key] ?? null;
$old = $this->oldData[$key] ?? null;
$attribute = isset($this->attributes[$key]) ? $this->attributes[$key] : null;
$old = isset($this->oldData[$key]) ? $this->oldData[$key] : null;

if ($old === null && $attribute !== null) {
if ($attribute instanceof Closure || (is_array($attribute) && is_callable($attribute))) {
$old = call_user_func($attribute);
$old = $attribute();
} else {
$old = $attribute;
}
Expand Down

0 comments on commit f7fc42d

Please sign in to comment.