src/Controller/API/DefaultController.php line 8

Open in your IDE?
  1. <?php
  2. namespace App\Controller\API;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\JsonResponse;
  6. class DefaultController extends AbstractController {
  7.     use \App\Traits\Database;
  8.     public function index(Request $request) {
  9.         return $this->redirect('https://youngiz.ma');
  10.     }
  11.     public function getVersion(Request $request) {
  12.         if(!$this->container->get('ws.apikey')->apiKey()) return new JsonResponse(array('success'=>0'message'=>'INCORRECT_API_KEY'));
  13.         $conn=$this->getDoctrine()->getConnection();
  14.         $item=$this->fetchOne($conn'SELECT name FROM version ORDER BY creation_date DESC LIMIT 1');
  15.         return new JsonResponse($item);
  16.     }
  17. }
  18. ?>