Skip to content

Commit ad23393

Browse files
committed
serialize to int
1 parent 58dbafe commit ad23393

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MoneyCast.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ public function set(Model $model, string $key, mixed $value, array $attributes):
100100
* @param ?Money $value
101101
* @param array<string, mixed> $attributes
102102
*/
103-
public function serialize(Model $model, string $key, mixed $value, array $attributes): ?string
103+
public function serialize(Model $model, string $key, mixed $value, array $attributes): ?int
104104
{
105105
if ($value === null) {
106106
return $value;
107107
}
108108

109-
return (string) $value;
109+
return $value->getMinorAmount()->toInt();
110110
}
111111
}

0 commit comments

Comments
 (0)