cache->getItem('list_category_'.$category)->isHit()) { return $this->render('productList.html.twig', ['listType' => 'category_'.$category]); } $products = Product::with('price') ->selectRaw('products.*') ->distinct('products.id') ->fromRaw('products, json_each(products.categories)') ->whereRaw('json_each.value = ?', [$category]) ->orderByDesc('starred') ->orderByDesc('created_by') ->get(); return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'category_'.$category]); } }