<?php
namespace App\Controller;
use App\Service\AgencyCabinetAuth;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class DefaultController extends AbstractController
{
/**
* Корінь сайту (SPEC-T27): співробітник із сесією адмінки — в адмінку, агент із входом — в оголошення,
* гість — промо-сторінка для турфірм з control.otpusk.com.
*
* @Route("/", name="root", methods={"GET"})
*/
public function index(Request $request, AgencyCabinetAuth $auth): Response
{
if ($request->getSession()->has('admin')) {
return $this->redirectToRoute('admin_dashboard');
}
if ($auth->manager($request)) {
return $this->redirect('/listings');
}
return $this->render('cabinet/home.html.twig', ['manager' => null, 'meta' => ['title' => 'Інформація для турфірм']]);
}
}