Use MicroKernelTrait to bootstrap application. Rewrote routes, controllers and structure of application a bit. Including use of twig.
This commit is contained in:
@@ -3,10 +3,13 @@
|
||||
namespace Krzysiej\RyobiCrawler\Controller;
|
||||
|
||||
use Krzysiej\RyobiCrawler\Models\Product;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
final class CategoryController extends BaseController
|
||||
{
|
||||
public function __invoke(string $category): void
|
||||
#[Route('/category/{category}', name: 'app_category')]
|
||||
public function __invoke(string $category): Response
|
||||
{
|
||||
$products = Product::with('price')
|
||||
->selectRaw('products.*')
|
||||
@@ -15,6 +18,6 @@ final class CategoryController extends BaseController
|
||||
->orderByDesc('starred')
|
||||
->orderByDesc('created_by')
|
||||
->get();
|
||||
$this->twig->display('productList.html.twig', ['products' => $products]);
|
||||
return $this->render('productList.html.twig', ['products' => $products]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user