<?php
namespace App\Controller;
use App\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Doctrine\ORM\EntityManagerInterface;
class DashboardController extends Controller
{
/**
* @var EntityManagerInterface
*/
protected EntityManagerInterface $entityManager;
public function __construct
(
EntityManagerInterface $entityManager
)
{
$this->entityManager = $entityManager;
}
/**
* @Route("/", name="dashboard")
*/
public function index(): Response
{
$user = $this->getUser();
if ($user){
$user->setLoginDate(new \DateTime());
$this->entityManager->persist($user);
$this->entityManager->flush();
}
return $this->render('dashboard/index.html.twig', [
'controller_name' => 'AdminController',
]);
}
}