Skip to content

Commit

Permalink
馃悰 fix for cannot unpack array with string keys
Browse files Browse the repository at this point in the history
  • Loading branch information
yungts97 committed Oct 2, 2022
1 parent f0518ed commit 9cd9981
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Traits/ListenerTraits/HasData.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protected function getData()

$mode = config("user-activity-log.mode", 'simple');
return $this->event_name === 'edit' && $mode === 'simple' ?
Arr::except([...$this->event->model->getChanges(), 'id' => $this->event->model->id], $this->event->model->log_hidden ?? []) :
Arr::except(array_merge($this->event->model->getChanges(), ['id' => $this->event->model->id]), $this->event->model->log_hidden ?? []) :
Arr::except($this->event->model->getRawOriginal(), $this->event->model->log_hidden ?? []);
}
}
2 changes: 1 addition & 1 deletion tests/Feature/UserActivityLogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function it_can_log_on_edit_event_with_simple_mode()

//since the latest log is edit type, so just simply use latest log to test
$actualLogData = $newPost->log->data;
$expectedLogData = [...$newPost->getChanges(), 'id' => $newPost->id];
$expectedLogData = array_merge($newPost->getChanges(), ['id' => $newPost->id]);
$this->assertTrue($expectedLogData == $actualLogData);
}

Expand Down

0 comments on commit 9cd9981

Please sign in to comment.