Keep track of discontinued items. That means items that were tracked, but then they were never updated.Added is discontinued badge.

This commit is contained in:
Krzysztof Płaczek
2025-02-15 11:33:24 +01:00
parent 7eb7bf3eb2
commit 81f9c863c7
7 changed files with 52 additions and 9 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace Krzysiej\RyobiCrawler\Controller;
use Krzysiej\RyobiCrawler\Models\Product;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use function Symfony\Component\Clock\now;
final class DiscontinuedController extends BaseController
{
#[Route('/discontinued', name: 'app_discontinued')]
public function __invoke(): Response
{
$products = Product::where('updated_at', '<', now()->format('Y-m-d'))
->orderByDesc('starred')
->orderByDesc('created_by')
->with(['currentPrice'])
->get();
return $this->render('productList.html.twig', ['products' => $products]);
}
}