<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class ProSiteController extends AbstractController
{
#[Route('/', name: 'pro_home', host: 'flexenergie.pro')]
public function index(): Response
{
// Si l'utilisateur est connecté et a le rôle ROLE_CLIENT_PRO
if ($this->getUser() && in_array('ROLE_CLIENT_PRO', $this->getUser()->getRoles())) {
return $this->redirectToRoute('pro_dashboard');
}
// Sinon, afficher la page d'accueil pro
return $this->render('pro_site/index.html.twig');
}
}