cmtracker/src/Controller/DefaultController.php
2024-11-28 11:37:56 -05:00

31 lines
905 B
PHP

<?php
namespace App\Controller;
use App\Entity\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\CurrentUser;
class DefaultController extends AbstractController
{
#[Route('/dashboard', name: 'app_dashboard')]
public function dashboard(Request $request, #[CurrentUser()] ?User $user): Response
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
if (!$user->getCompany()) {
return $this->redirectToRoute('app_register_step', ['step' => RegistrationController::REGISTER_STEP_TWO]);
}
return $this->render(
'internal/dashboard.html.twig',
[
'user' => $user
]
);
}
}