cmtracker/src/Controller/StaffController.php

43 lines
1.3 KiB
PHP

<?php
namespace App\Controller;
use App\Entity\User;
use App\Libs\NavList;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\CurrentUser;
class StaffController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly UserPasswordHasherInterface $userPasswordHasher,
private array $navLinks = []
) {
$this->navLinks = NavList::LIST;
}
#[Route('/staff-dashboard', name: 'staff')]
public function staffDashboard(#[CurrentUser()] User $user): Response
{
$this->navLinks['staff_dashboard'] = 'nav-link text-white active bg-gradient-dark';
return $this->render(
'internal/staff/staff-dashboard.html.twig',
array_merge(
$this->navLinks,
[
'breadcrumbs' => [
'Staff Dashboard'
],
'notifications' => $user->retrieveUnreadNotifications(),
]
)
);
}
}