diff --git a/src/Controller/ProductController.php b/src/Controller/ProductController.php index 54819da..408b0c7 100644 --- a/src/Controller/ProductController.php +++ b/src/Controller/ProductController.php @@ -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),