src/Controller/HomeController.php line 62

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Form\ContactFormType;
  4. use App\Repository\DentisteRepository;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Mailer\MailerInterface;
  8. use Symfony\Component\Mime\Email;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. use App\Entity\Contact;
  11. use Doctrine\ORM\EntityManagerInterface;
  12. use Symfony\Component\BrowserKit\Request as BrowserKitRequest;
  13. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  14. use Symfony\Component\DependencyInjection\Loader\Configurator\mailer;
  15. use Symfony\Component\HttpFoundation\Request as HttpFoundationRequest;
  16. use Symfony\Bridge\Twig\Mime\TemplatedEmail;
  17. class HomeController extends AbstractController
  18. {
  19.     private $dentistesRepository;
  20.     public function __construct(DentisteRepository $dentisteRepository)
  21.     {   
  22.         $this->dentistesRepository $dentisteRepository;
  23.     }
  24.     #[Route('/'name'app_home')]
  25.     public function index(): Response
  26.     {   
  27.         $dentistes $this->dentistesRepository->findAll();
  28.         return $this->render('home/index.html.twig', [
  29.             'dentistes' => $dentistes,
  30.             'controller_name' => 'HomeController',
  31.         ]);
  32.     }
  33.     #[Route('/blog'name'app_blog')]
  34.     public function blog(): Response
  35.     {   
  36.         $dentistes $this->dentistesRepository->findAll();
  37.         return $this->render('home/blog.html.twig', [
  38.             'dentistes' => $dentistes,
  39.             'controller_name' => 'HomeController',
  40.         ]);
  41.     }
  42.     #[Route('/quisommesnous'name'app_quisommesnous')]
  43.     public function quisommesnous(): Response
  44.     {
  45.         return $this->render('home/quisommesnous.html.twig', [
  46.             'controller_name' => 'HomeController',
  47.         ]);
  48.     }
  49.     #[Route('/videos'name'app_videos')]
  50.     public function videos(): Response
  51.     {
  52.         return $this->render('home/videos.html.twig', [
  53.             'controller_name' => 'HomeController',
  54.         ]);
  55.     }
  56.     #[Route('/service'name'app_service')]
  57.     public function service(): Response
  58.     {
  59.         return $this->render('services/service.html.twig', [
  60.             'controller_name' => 'HomeController',
  61.         ]);
  62.     }
  63.     #[Route('/urgencedentaire'name'app_urgencedentaire')]
  64.     public function urgencedentaire(): Response
  65.     {
  66.         return $this->render('services/urgencedentaire.html.twig', [
  67.             'controller_name' => 'HomeController',
  68.         ]);
  69.     }
  70.     // #[Route('/contactt', name: 'contactt')]
  71.     // public function contact(Request $request,MailerInterface $mailer): Response
  72.     // {    
  73.          
  74.     //     $form = $this->createForm(ContactFormType::class);
  75.     //     $form->handleRequest($request);
  76.     //     if ($form->isSubmitted() && $form->isValid()) {
  77.     //         $formData = $form->getData();
  78.             
  79.     //         // dd($formData);
  80.             
  81.     //         $email = (new Email())
  82.     //         ->from('contact@ksdental.ma')
  83.     //         ->to('ayoubelkalali@gmail.com')
  84.     //         //->cc('cc@example.com')
  85.     //         //->bcc('bcc@example.com')
  86.     //         //->replyTo('fabien@example.com')
  87.     //         //->priority(Email::PRIORITY_HIGH)
  88.     //         ->subject('Time for Symfony Mailer!')
  89.     //         ->text('Sending emails is fun again!')
  90.     //         ->html('<p>See Twig integration for better HTML integration!</p>');
  91.     //             $mailer->send($email);
  92.     //              $this->addFlash('success', 'Message sent!');
  93.     //     }
  94.     //      // dd($formData);
  95.     //     return $this->render('home/contact.html.twig', [
  96.     //         'form' => $form->createView(),
  97.              
  98.     //     ]);
  99.     // }
  100.     // #[Route('/sendEmail', name: 'sendEmail')]
  101.     // public function sendEmail(Request $request,MailerInterface $mailer): Response
  102.     // {
  103.     //   $email = (new Email())
  104.     //         ->from('contact@ksdental.ma')
  105.     //         ->to('ayoubelkalali@gmail.com')
  106.     //         //->cc('cc@example.com')
  107.     //         //->bcc('bcc@example.com')
  108.     //         //->replyTo('fabien@example.com')
  109.     //         //->priority(Email::PRIORITY_HIGH)
  110.     //         ->subject('Time for Symfony Mailer!')
  111.     //         ->text('Sending emails is fun again!')
  112.     //         ->html('<p>See Twig integration for better HTML integration!</p>');
  113.     //             $mailer->send($email);
  114.     //              $this->addFlash('success', 'Message sent!');
  115.         
  116.         
  117.     //     return $this->render('home/contact.html.twig', [
  118.     //         'controller_name' => 'HomeController',
  119.     //     ]);
  120.     // }
  121.     
  122. }