<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class IndexController extends AbstractController {
#[Route(path: '/', name: 'app_index')]
public function index() {
$user = $this->getUser();
if (in_array("ROLE_ADMIN", $user->getRoles())) {
return $this->redirectToRoute('api_user_index');
} elseif (in_array("ROLE_VETERINARY", $user->getRoles())) {
return $this->redirectToRoute('api_client_index');
}else{
return $this->redirectToRoute('app_login');
}
}
}