From 369bacc38ca7478a2f2dd2c214a478a06290c4c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20P=C5=82aczek?= Date: Tue, 26 Nov 2024 08:28:23 +0100 Subject: [PATCH] Remove duplicate products in category view due to the bug with the list of category. --- src/Controller/CategoryController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Controller/CategoryController.php b/src/Controller/CategoryController.php index a6dafcb..d5afe47 100644 --- a/src/Controller/CategoryController.php +++ b/src/Controller/CategoryController.php @@ -13,6 +13,7 @@ final class CategoryController extends BaseController { $products = Product::with('price') ->selectRaw('products.*') + ->distinct('products.id') ->fromRaw('products, json_each(products.categories)') ->whereRaw('json_each.value = ?', [$category]) ->orderByDesc('starred')