mirror of
https://github.com/archtechx/money.git
synced 2025-12-12 11:24:03 +00:00
cents() method
This commit is contained in:
parent
8dc5287868
commit
f5bf658155
2 changed files with 24 additions and 0 deletions
|
|
@ -249,6 +249,15 @@ final class Money implements JsonSerializable, Arrayable, Wireable
|
|||
return $this->rounded()->value() - $this->value();
|
||||
}
|
||||
|
||||
/** Get the cents from the decimal value. */
|
||||
public function cents(): static
|
||||
{
|
||||
return static::fromDecimal(
|
||||
$this->decimal() - floor($this->decimal()),
|
||||
$this->currency,
|
||||
);
|
||||
}
|
||||
|
||||
public function toLivewire()
|
||||
{
|
||||
return $this->toArray();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue