21 lines
574 B
PHP
21 lines
574 B
PHP
<?php
|
|
|
|
namespace Krzysiej\RyobiCrawler\Controller;
|
|
|
|
use Krzysiej\RyobiCrawler\Models\Product;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
|
|
final class IndexController extends BaseController
|
|
{
|
|
#[Route('/', name: 'app_home')]
|
|
public function __invoke(): Response
|
|
{
|
|
$products = Product::with(['currentStock', 'price'])
|
|
->orderByDesc('starred')
|
|
->orderByDesc('created_by')
|
|
->get();
|
|
return $this->render('productList.html.twig', ['products' => $products]);
|
|
}
|
|
}
|