src/Controller/faqController.php line 31

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Contracts\HttpClient\HttpClientInterface;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. class faqController extends AbstractController
  8. {
  9.     private $client;
  10.     public function __construct(HttpClientInterface $client)
  11.     {
  12.         $this->client $client;
  13.     }
  14.     
  15.     /**
  16.      * @Route("/faq")
  17.      */
  18.     public function renderFaqPage()
  19.     {
  20.         $response $this->client->request(
  21.             'GET',
  22.             "{$_ENV['BASE_API']}faqs"
  23.         );
  24.         $content $response->toArray()["faqs"];
  25.         return $this->render('./faq/faq.html.twig', array(
  26.             "faqs" => $content,
  27.             "pro" => "false",
  28.             "base" => "base.html.twig"
  29.         ));
  30.         
  31.     }
  32.      /**
  33.      * @Route("/pro/faq")
  34.      */
  35.     public function renderFaqProPage()
  36.     {
  37.         $response $this->client->request(
  38.             'GET',
  39.             "{$_ENV['BASE_API']}faqs/pro"
  40.         );
  41.         $content $response->toArray()["faqs"];
  42.         return $this->render('./faq/faq.html.twig', array(
  43.             "faqs" => $content,
  44.             "pro" => "true",
  45.             "base" => "/pro/base.html.twig"
  46.         ));
  47.         
  48.     }
  49. }
  50. ?>