PostScripton/laravel-money

Raising precision

Closed this issue · 3 comments

NON-integer columns

It's been decided to abandon NON-integer columns in databases.
Now it is always an integer!

The persistent precision is now 4 decimals for databases.

Now the decimals setting is only responsible for displaying money.
Meanwhile, databases will always have 4 decimals no matter what.


DATABASE

id name email balance
1 John john@mail.com 12582000

DECIMALS IN CONFIG
1

HOW IT ACTUALLY LOOKS LIKE

$user->balance->toString(); // "$ 1 258.2"

I suppose, a use-case would be like:

money(123400);  // $ 12.34
money(12.34);   // $ 12.34
money('12.34'); // $ 12.34 (not sure about strings, but... why not?)

UPD:

money('123400');
Money::parse('12.34');

Have to do this first: #49