src/Controller/IndexController.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. class IndexController extends AbstractController {
  6.     #[Route(path'/'name'app_index')]
  7.     public function index() {
  8.         $user $this->getUser();
  9.         if (in_array("ROLE_ADMIN"$user->getRoles())) {
  10.             return $this->redirectToRoute('api_user_index');
  11.         } elseif (in_array("ROLE_VETERINARY"$user->getRoles())) {
  12.             if ($user->hasCanopia()) {
  13.                 return $this->redirectToRoute('check_in_index');
  14.             } else if ($user->hasDocval()) {
  15.                 return $this->redirectToRoute('document_html_index');
  16.             } else {
  17.                 return $this->render("landing_page.html.twig");
  18.             }
  19.         }else{
  20.             return $this->redirectToRoute('app_login');
  21.         }
  22.     }
  23. }