santRepository = $santRepository; } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { try { $response = $this->santRepository->getSantList($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(StoreSantRequest $request) { try { $response = $this->santRepository->createSant($request); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * Display the specified resource. * * @param \App\Models\Sant $sant * @return \Illuminate\Http\Response */ public function show(Sant $sant) { try { $response = $this->santRepository->showSant($sant); $this->updateStatusCode($response); return $this->respond($response); } catch (\Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Display the specified resource. * * @param \App\Models\Sant $sant * @return \Illuminate\Http\Response */ public function showInReviewSant(Sant $sant) { try { $response = $this->santRepository->inReviewSantDetail($sant); $this->updateStatusCode($response); return $this->respond($response); } catch (\Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Update the specified resource in storage. * * @param UpdateSantRequest $request * @param \App\Models\Sant $sant * @return \Illuminate\Http\Response */ public function update(UpdateSantRequest $request, Sant $sant) { try { $response = $this->santRepository->updateSant($sant,$request); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * Remove the specified resource from storage. * * @param \App\Models\Sant $sant * @return \Illuminate\Http\Response */ public function destroy(Sant $sant) { // } /** * Get list of father. * * @param \App\Models\Sant $sant * @return \Illuminate\Http\Response */ public function santFatherList(Request $request) { try { $response = $this->santRepository->santFatherList($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * Get list of father. * * @param \App\Models\Sant $sant * @return \Illuminate\Http\Response */ public function santMotherList(Request $request) { try { $response = $this->santRepository->santMotherList($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * Get list of in review sant. * * @param \App\Models\Sant $sant * @return \Illuminate\Http\Response */ public function inReviewSant(Request $request) { try { $response = $this->santRepository->inReviewSant($request->all()); $this->updateStatusCode($response); return $this->respond($response); } catch (\Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Get list of in review sant. * * @param \App\Models\Sant $sant * @return \Illuminate\Http\Response */ public function userSantList(Request $request) { try { $response = $this->santRepository->userSantList($request->all()); $this->updateStatusCode($response); return $this->respond($response); } catch (\Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Follow sant. * @return \Illuminate\Http\Response */ public function santFollow(SantFollowRequest $request) { try { $response = $this->santRepository->santFollow($request->all()); $this->updateStatusCode($response); return $this->respond($response); } catch (\Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Get suuggestion sant. * @return \Illuminate\Http\Response */ public function santSuggestion(Request $request) { try { $response = $this->santRepository->santSuggestion($request->all()); $this->updateStatusCode($response); return $this->respond($response); } catch (\Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Get suuggestion sant. * @param \App\Models\Sant $sant * @return \Illuminate\Http\Response */ public function santFollowers(Request $request,Sant $sant) { try { $response = $this->santRepository->santFollowers($request->all(), $sant); $this->updateStatusCode($response); return $this->respond($response); } catch (\Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function getSantFeeds(Request $request) { try { $response = $this->santRepository->getSantFeeds($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * Store/updates sant's current location. * * @return \Illuminate\Http\Response */ public function updateSantLocation(Request $request) { try { $response = $this->santRepository->updateSantLocation($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } }