Start working on sorting products by different columns.
This commit is contained in:
@@ -3,18 +3,17 @@
|
||||
namespace Krzysiej\RyobiCrawler\Controller;
|
||||
|
||||
use Krzysiej\RyobiCrawler\Models\Product;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
final class IndexController extends BaseController
|
||||
{
|
||||
#[Route('/', name: 'app_home')]
|
||||
public function __invoke(): Response
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
$products = Product::with(['currentStock', 'price'])
|
||||
->orderByDesc('starred')
|
||||
->orderByDesc('created_by')
|
||||
->get();
|
||||
$products = Product::with(['currentStock', 'price', 'currentPrice']);
|
||||
$products = $this->handleOrderProducts($products, $request)->get();
|
||||
return $this->render('productList.html.twig', ['products' => $products]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user