Closed jinbatsu closed 7 months ago
I solved for a moment forced devide 100 using Attribute Model. So every request get value is devided by 100. And MoneyInput now display correct result.
protected function sampleSalary(): Attribute
{
return Attribute::make(
get: fn (string $value) => $value > 0 ? $value/100 : 0,
);
}
Great that you found a solution. Yes, this should probably be easier and more clear. At least some documentation should be added for this.
OK, thanks.. it means we do not need to force devide 100 in the model anymore.
How to cast the value? Because, the default is saved in database with extra 00. And in the edit or view page, it is not devided by 100.
I though it is already automated by MoneyInput ?