<?php
namespace App\Controller\API;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
class DefaultController extends AbstractController {
use \App\Traits\Database;
public function index(Request $request) {
return $this->redirect('https://youngiz.ma');
}
public function getVersion(Request $request) {
if(!$this->container->get('ws.apikey')->apiKey()) return new JsonResponse(array('success'=>0, 'message'=>'INCORRECT_API_KEY'));
$conn=$this->getDoctrine()->getConnection();
$item=$this->fetchOne($conn, 'SELECT name FROM version ORDER BY creation_date DESC LIMIT 1');
return new JsonResponse($item);
}
}
?>