<?php
declare(strict_types=1);
namespace App\Controller\Public;
use App\Repository\EventRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class EventController extends AbstractController {
#[Route('/evenementen', name: 'events')]
public function index(EventRepository $eventRepository): Response {
$now = (new \DateTime())->setTimezone(new \DateTimeZone("Europe/Brussels"));
$time = $now->format("H:i:s");
$date = $now->format("Y-m-d");
return $this->render("/public/event/index.html.twig", [
"events" => $eventRepository->findByDate($date, $time)
]);
}
}