Fix product chart values for stock and price. #63

Merged
krzysiej merged 1 commits from fix/product-chart-values into master 2026-02-08 12:30:46 +01:00
Showing only changes of commit 074de13175 - Show all commits

View File

@@ -28,6 +28,10 @@ final class ProductController extends BaseController
}
$priceList = $product->price()->pluck('price', 'created_at')->mapWithKeys(fn($price, $createdAt) => [explode(' ', $createdAt)[0] => $price])->toArray();
$stockList = $product->stock()->pluck('stock', 'created_at')->mapWithKeys(fn($stock, $createdAt) => [explode(' ', $createdAt)[0] => $stock])->toArray();
ksort($stockList);
ksort($priceList);
return $this->render('product.html.twig', [
'product' => $product,
'price_list' => $this->prepareChartData($priceList),