cmtracker/src/Controller/StaffController.php

48 lines
1.5 KiB
PHP
Raw Normal View History

<?php
namespace App\Controller;
use App\Entity\User;
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 = [
'admin_dashboard' => 'nav-link text-dark',
'user_dashboard' => 'nav-link text-dark',
'profile' => 'nav-link text-dark',
'user_list' => 'nav-link text-dark',
'staff_dashboard' => 'nav-link text-dark',
];
}
#[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(),
]
)
);
}
}