src/Controller/LocationController.php line 35

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\CountryRepository;
  4. use App\Repository\HospitalRepository;
  5. use App\Repository\StaffProfileRepository;
  6. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\{JsonResponseRequest};
  9. use Symfony\Component\Routing\Annotation\Route;
  10. #[Route(path'/location'), IsGranted(data'IS_AUTHENTICATED_REMEMBERED')]
  11. class LocationController extends AbstractController
  12. {
  13.     #[Route(path'/districts'name'location_district_json'methods: ['GET'])]
  14.     public function districts(Request $requestCountryRepository $countryRepo): JsonResponse
  15.     {
  16.         $stateId $request->query->get('state_id');
  17.         $districts $countryRepo->getDistricts($stateId);
  18.         return $this->json($districts);
  19.     }
  20.     #[Route(path'/talukas'name'location_taluka_json'methods: ['GET'])]
  21.     public function talukas(Request $requestCountryRepository $countryRepo): JsonResponse
  22.     {
  23.         $districtId $request->query->get('district_id');
  24.         $talukas $countryRepo->getTalukas($districtId);
  25.         return $this->json($talukas);
  26.     }
  27.     #[Route(path'/villages'name'location_village_json'methods: ['GET'])]
  28.     public function villages(Request $requestCountryRepository $countryRepo): JsonResponse
  29.     {
  30.         $talukaId $request->query->get('taluka_id');
  31.         $villages $countryRepo->getVillages($talukaId);
  32.         return $this->json($villages);
  33.     }
  34.     #[Route(path'/type'name'hospital_list_by_type'methods: ['GET'])]
  35.     public function getHospitalByType(Request $requestHospitalRepository $hospitalRepo): JsonResponse
  36.     {
  37.         $centerType $request->query->get('center_type');
  38.         $hospitalList $hospitalRepo->getHospitalByCenterType($centerType);
  39.         return new JsonResponse($hospitalList);
  40.     }
  41.     #[Route(path'/category'name'doctor_list_by_category'methods: ['GET'])]
  42.     public function getDoctorByCategory(Request $requestHospitalRepository $hospitalRepo): JsonResponse
  43.     {
  44.         $doctorCategory $request->query->get('doctor_category');
  45.         $doctorList $hospitalRepo->getDoctorListByCategory($doctorCategory);
  46.         return new JsonResponse($doctorList);
  47.     }
  48.     #[Route(path'/getEmail'name'email_by_doctor'methods: ['GET'])]
  49.     public function getEmailByDoctor(Request $requestStaffProfileRepository $staffProfileRepo): JsonResponse
  50.     {
  51.         $doctorId $request->query->get('doctor_category');
  52.         $getEmail $staffProfileRepo->getEmailByDoctor($doctorId);
  53.         return new JsonResponse($getEmail);
  54.     }
  55. }