diff --git a/src/Controller/PromosController.php b/src/Controller/PromosController.php index 05319b1..a25825b 100644 --- a/src/Controller/PromosController.php +++ b/src/Controller/PromosController.php @@ -12,7 +12,11 @@ final class PromosController extends BaseController #[Route('/promos', name: 'app_promos')] public function __invoke(): Response { - $products = Product::whereHas('currentPrice', fn(Builder $query) => $query->whereColumn('price', '<', 'productStandardPrice'))->with(['currentPrice'])->get(); + $products = Product::whereHas('currentPrice', fn(Builder $query) => $query->whereColumn('price', '<', 'productStandardPrice')) + ->orderByDesc('starred') + ->orderByDesc('created_by') + ->with(['currentPrice']) + ->get(); return $this->render('productList.html.twig', ['products' => $products]); } }