<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class DefaultController extends AbstractController
{
#[Route('/')]
public function index(): Response
{
return $this->render('default/index.html.twig', [
]);
}
#[Route('/draw/')]
public function draw(): Response
{
return $this->render('draw/index.html.twig', [
]);
}
#[Route('/terms/', name: 'terms')]
public function termsCosmote(): Response
{
return $this->render('terms.html.twig', [
]);
}
#[Route('/statistics/', name: 'statistics')]
public function stats(
\App\Repository\ParticipantRepository $participantRepository,
\App\Repository\CodeRepository $codeRepository,
\App\Repository\InstantWinRepository $instantWinRepository
): Response
{
$totalParticipants =$participantRepository->countTotal();
$totalParticipantsWon = $participantRepository->countTotalWon();
$instantWins = $instantWinRepository->countTotal();
$instantWinsRemain = $instantWinRepository->countTotalActive();
$codesTotal = $codeRepository->countTotal();
$codesActive = $codeRepository->countTotalActive();
return $this->render('statistics.html.twig', [
"totalParticipants" => $totalParticipants,
"totalParticipantsWon" => $totalParticipantsWon,
"codesTotal" => $codesTotal,
"codesActive" => $codesActive,
"instantWins" => $instantWins,
"instantWinsRemain" => $instantWinsRemain
]);
}
}