Currency recalc, design

This commit is contained in:
2024-01-07 09:18:07 +01:00
parent 23f69817c0
commit 691e9b8841
2 changed files with 56 additions and 34 deletions

View File

@@ -52,8 +52,9 @@ class ProductsCompareController extends Controller
$coef = floatval(CurrencyRates::where('currency',$currency)->first()->rate);
}
$products = $products->map(function ($product) use ($currencyRates, $coef) {
$products = $products->map(function ($product) use ($currencyRates, $coef, $cHash) {
$product["salesPrice"] = round(floatval(($product["salesPrice"]) / $currencyRates[$product["country"]]) * $coef, 2);
$product["countryName"] = $cHash[$product["country"]];
return $product;
});
Log::info("{products}", ["products" => $products]);