Lines
100.00%
5 / 5
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Index | 100.00% | 5 / 5 | 100.00% | 1 / 1 | 1 | 100.00% | 1 / 1 | |||
| __invoke | 100.00% | 5 / 5 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | namespace App\Controller\User; | |
| 4 | ||
| 5 | use App\Controller\BaseController; | |
| 6 | use App\Enum\UserRole; | |
| 7 | use App\Repository\AgentStatRepository; | |
| 8 | use App\Repository\UserRepository; | |
| 9 | use Symfony\Component\HttpFoundation\Response; | |
| 10 | use Symfony\Component\Routing\Attribute\Route; | |
| 11 | use Symfony\Component\Security\Http\Attribute\IsGranted; | |
| 12 | ||
| 13 | /** | |
| 14 | * Every user, with the agent, the privacy settings and every picture (as the app's admin agents). | |
| 15 | */ | |
| 16 | #[Route('/admin/agents', name: 'app_user_index', methods: ['GET'])] | |
| 17 | #[IsGranted(UserRole::ADMIN->value)] | |
| 18 | final class Index extends BaseController | |
| 19 | { | |
| 20 | public function __invoke(UserRepository $userRepository, AgentStatRepository $agentStatRepository): Response | |
| 21 | { | |
| 22 | $users = $userRepository->findAllByAgentName(); | |
| 23 | ||
| 24 | return $this->render('user/index.html.twig', [ | |
| 25 | 'users' => $users, | |
| 26 | 'latest' => $agentStatRepository->findLatestByOwners($users), | |
| 27 | ]); | |
| 28 | } | |
| 29 | } |