+ Fix bugs on currency rounding v3
This commit is contained in:
parent
befa624dd4
commit
0f6da25c0b
|
@ -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
|
$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();
|
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');
|
return $money->formatTo('fr_FR');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toMoney($amount, $id_country)
|
public function toMoney($amount, $id_country)
|
||||||
{
|
{
|
||||||
$country = Country::findOrFail($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');
|
return $money->formatTo('fr_FR');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue