Skip to content

Commit

Permalink
Change $this->getAttributes() to $this->attributesToArray() (#79)
Browse files Browse the repository at this point in the history
* feat: Add support for other Foreign Key for different Models

You must first create a model with such a foreign key instead of default user_id

* Change $this->getAttributes() to $this->attributesToArray()

With large numbers, the getAttributes() method converts them to strings, while using attributesToArray() allows them to be cast to integers.

---------

Co-authored-by: robsonek <[email protected]>
  • Loading branch information
robsonek and robsonek authored Jul 9, 2024
1 parent 0dab354 commit bcff615
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Versionable.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ protected function getSnapshotAttributes(array $replacements = []): array
$versionable = $this->getVersionable();
$dontVersionable = $this->getDontVersionable();

$attributes = count($versionable) > 0 ? $this->only($versionable) : $this->getAttributes();
$attributes = count($versionable) > 0 ? $this->only($versionable) : $this->attributesToArray();

return Arr::except(array_merge($attributes, $replacements), $dontVersionable);
}
Expand Down

0 comments on commit bcff615

Please sign in to comment.