Skip to content

Commit

Permalink
serialize to int
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Aug 28, 2024
1 parent 58dbafe commit ad23393
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/MoneyCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ public function set(Model $model, string $key, mixed $value, array $attributes):
* @param ?Money $value
* @param array<string, mixed> $attributes
*/
public function serialize(Model $model, string $key, mixed $value, array $attributes): ?string
public function serialize(Model $model, string $key, mixed $value, array $attributes): ?int
{
if ($value === null) {
return $value;
}

return (string) $value;
return $value->getMinorAmount()->toInt();
}
}

0 comments on commit ad23393

Please sign in to comment.