src/Controller/UserController.php line 23
<?phpnamespace App\Controller;use App\Entity\User;use App\Form\User1Type;use App\Repository\UserRepository;use Doctrine\ORM\EntityManagerInterface;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;use Knp\Component\Pager\PaginatorInterface;#[Route('/user')]class UserController extends AbstractController{#[Route('/privacy', name: 'privacy')]public function privacy(EntityManagerInterface $entityManager): Response{$html = <<<HTML<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Privacy Policy - LVB</title><style>body { font-family: Arial, sans-serif; padding: 20px; line-height: 1.6; max-width: 800px; margin: auto; }h1, h2 { color: #2c3e50; }ul { margin-top: 0; }.section { margin-bottom: 30px; }</style></head><body><h1>Privacy Policy</h1><p><strong>Last updated:</strong> April 4, 2025</p><div class="section"><h2>Welcome to LVB</h2><p>LVB is your trusted platform for connecting with skilled professionals offering services such as:</p><ul><li>Home Services</li><li>Beauty and Wellness Treatments</li><li>Personal Training and Coaching</li></ul></div><div class="section"><h2>Your Privacy Matters</h2><p>At LVB, we prioritize the privacy and security of our users. We do not collect or store any unnecessary personal information related to your activities. The only data we handle pertains to service bookings, provider profiles, and client-provider interactions — all used solely to deliver the best experience possible.</p></div><div class="section"><h2>Security & Transparency</h2><p>We implement strict safeguards to keep your information secure, including encrypted storage and verified service providers. Our platform is designed to give you peace of mind while using our services.</p></div><div class="section"><h2>Your Rights</h2><ul><li>Access and modify your personal data</li><li>Request account deletion</li><li>Contact support for any privacy concerns</li></ul></div><div class="section"><h2>Contact Us</h2><p>If you have any questions about this Privacy Policy, please contact us:</p><p>Email: <a href="mailto:support@lvb.app">support@lvb.app</a><br></p></div><p>Thank you for using LVB. We are committed to maintaining your trust.</p></body></html>HTML;return new Response($html);}#[Route('/accepted', name: 'app_users_accepted')]public function showAcceptedUsers(EntityManagerInterface $entityManager){// Fetch users with status 1 (Accepted)$users = $entityManager->getRepository(User::class)->findBy(['status' => 1]);return $this->render('user/accepted_users.html.twig', ['users' => $users,]);}#[Route('/rejected', name: 'app_users_rejected')]public function showRejectedUsers(EntityManagerInterface $entityManager){// Fetch users with status 2 (Rejected)$users = $entityManager->getRepository(User::class)->findBy(['status' => 2]);return $this->render('user/rejected_users.html.twig', ['users' => $users,]);}#[Route('/pending', name: 'app_users_pending')]public function showPendingUsers(EntityManagerInterface $entityManager){// Fetch users with status 0$users = $entityManager->getRepository(User::class)->findBy(['status' => 0]);return $this->render('user/pending_users.html.twig', ['users' => $users,]);}#[Route('/update-status/{id}/{status}', name: 'app_users_update_status')]public function updateUserStatus($id, $status, EntityManagerInterface $entityManager, Request $request){// Fetch the user by ID$user = $entityManager->getRepository(User::class)->find($id);if (!$user) {$this->addFlash('error', 'User not found');return $this->redirectToRoute('app_users_pending');}// Update the status$user->setStatus($status);$entityManager->flush();$this->addFlash('success', 'User status updated successfully');return $this->redirectToRoute('app_users_pending');}#[Route('/', name: 'app_user_index', methods: ['GET'])]public function index(UserRepository $userRepository): Response{return $this->render('user/index.html.twig', ['users' => $userRepository->findAll(),]);}#[Route('/new', name: 'app_user_new', methods: ['GET', 'POST'])]public function new(Request $request, EntityManagerInterface $entityManager): Response{$user = new User();$form = $this->createForm(User1Type::class, $user);$form->handleRequest($request);if ($form->isSubmitted() && $form->isValid()) {$entityManager->persist($user);$entityManager->flush();return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER);}return $this->render('user/new.html.twig', ['user' => $user,'form' => $form,]);}#[Route('/{id}', name: 'app_user_show', methods: ['GET'])]public function show(User $user): Response{return $this->render('user/show.html.twig', ['user' => $user,]);}#[Route('/{id}/edit', name: 'app_user_edit', methods: ['GET', 'POST'])]public function edit(Request $request, User $user, EntityManagerInterface $entityManager): Response{$form = $this->createForm(User1Type::class, $user);$form->handleRequest($request);if ($form->isSubmitted() && $form->isValid()) {$entityManager->flush();return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER);}return $this->render('user/edit.html.twig', ['user' => $user,'form' => $form,]);}#[Route('/{id}', name: 'app_user_delete', methods: ['POST'])]public function delete(Request $request, User $user, EntityManagerInterface $entityManager): Response{if ($this->isCsrfTokenValid('delete'.$user->getId(), $request->request->get('_token'))) {$entityManager->remove($user);$entityManager->flush();}return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER);}}