From 0f6da25c0b0b3ed416b372bddfcd4602d98ff553 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Thu, 25 Jun 2020 20:08:55 +0100 Subject: [PATCH] + Fix bugs on currency rounding v3 --- app/Traits/Helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Traits/Helper.php b/app/Traits/Helper.php index ca34dd4..00431cb 100644 --- a/app/Traits/Helper.php +++ b/app/Traits/Helper.php @@ -55,14 +55,14 @@ trait Helper $currency = collect(DB::select('SELECT cu.code FROM networks n INNER JOIN countries c ON c.id = n.country_id INNER JOIN currencies cu ON cu.id = c.idCurrency WHERE n.id = :id',['id'=>$id_network]))->first(); - $money = Money::of(round($amount, 2),$currency ? $currency->code : 'XAF',new CustomContext(2)); + $money = Money::of(round($amount, 2),$currency ? $currency->code : 'XAF',new AutoContext()); return $money->formatTo('fr_FR'); } public function toMoney($amount, $id_country) { $country = Country::findOrFail($id_country); - $money = Money::of(round($amount, 2),$country->currency->code,new CustomContext(2)); + $money = Money::of(round($amount, 2),$country->currency->code,new AutoContext()); return $money->formatTo('fr_FR'); }