src/Controller/BaseController.php line 47

  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Contact;
  4. use App\Form\ContactType;
  5. use App\Notification\ContactNotification;
  6. use App\Service\CallApiFacebook;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. class BaseController extends AbstractController
  12. {
  13.     #[Route('/'name'app_index')]
  14.     public function index(Request $requestContactNotification $notificationCallApiFacebook $callApiFacebook): Response
  15.     {
  16.         $contact = new Contact();
  17.         $form $this->createForm(ContactType::class, $contact);
  18.         $form->handleRequest($request);
  19.         if($form->isSubmitted() && $form->isValid()){
  20.             $notification->notify($contact);
  21.             $this->addFlash('success''Votre email a bien été envoyé.');
  22.         }
  23.         return $this->render('pages/index.html.twig', [
  24.             'form' => $form,
  25.             'data' => $callApiFacebook->getAllData()
  26.         ]);
  27.     }
  28.     #[Route('/mentions-legales'name'app_mention')]
  29.     public function mentions(): Response
  30.     {
  31.         return $this->render('pages/mentions.html.twig');
  32.     }
  33.     #[Route('/politique-de-confidentialite'name'app_rgpd')]
  34.     public function rgpd(): Response
  35.     {
  36.         return $this->render('pages/rgpd.html.twig');
  37.     }
  38.     #[Route('/faq'name'app_faq')]
  39.     public function faq(): Response
  40.     {
  41.         return $this->render('pages/faq.html.twig');
  42.     }
  43. }