src/Controller/DefaultController.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. class DefaultController extends AbstractController
  7. {
  8.     #[Route('/')]
  9.     public function index(): Response
  10.     {
  11.         return $this->render('default/index.html.twig', [
  12.         ]);
  13.     }
  14.     #[Route('/draw/')]
  15.     public function draw(): Response
  16.     {
  17.         return $this->render('draw/index.html.twig', [
  18.         ]);
  19.     }
  20.     #[Route('/terms/'name'terms')]
  21.     public function termsCosmote(): Response
  22.     {
  23.         return $this->render('terms.html.twig', [
  24.         ]);
  25.     }
  26.     #[Route('/statistics/'name'statistics')]
  27.     public function stats(
  28.         \App\Repository\ParticipantRepository $participantRepository,
  29.         \App\Repository\CodeRepository $codeRepository,
  30.         \App\Repository\InstantWinRepository $instantWinRepository
  31.     ): Response
  32.     {
  33.         $totalParticipants =$participantRepository->countTotal();
  34.         $totalParticipantsWon $participantRepository->countTotalWon();
  35.         $instantWins $instantWinRepository->countTotal();
  36.         $instantWinsRemain $instantWinRepository->countTotalActive();
  37.         $codesTotal $codeRepository->countTotal();
  38.         $codesActive $codeRepository->countTotalActive();
  39.         return $this->render('statistics.html.twig', [
  40.             "totalParticipants" => $totalParticipants,
  41.             "totalParticipantsWon" => $totalParticipantsWon,
  42.             "codesTotal" => $codesTotal,
  43.             "codesActive" => $codesActive,
  44.             "instantWins" => $instantWins,
  45.             "instantWinsRemain" => $instantWinsRemain
  46.         ]);
  47.     }
  48. }