thanaRepository = $thanaRepository; } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { try { $response = $this->thanaRepository->getThanaList($request->all()); $this->updateStatusCode($response); return $this->respond($response); } catch (Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Store a newly created resource in storage. * * @param StoreThanaRequest $request * @return \Illuminate\Http\Response */ public function store(StoreThanaRequest $request) { try { $response = $this->thanaRepository->storeThana($request->all()); $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\Thana $thana * @return \Illuminate\Http\Response */ public function show(Thana $thana) { try { $response = $this->thanaRepository->showThana($thana); $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 UpdateThanaRequest $request * @param \App\Models\Thana $thana * @return \Illuminate\Http\Response */ public function update(UpdateThanaRequest $request, Thana $thana) { try { $response = $this->thanaRepository->updateThana($request->all(), $thana); $this->updateStatusCode($response); return $this->respond($response); } catch (\Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Remove the specified resource from storage. * * @param \App\Models\Thana $thana * @return \Illuminate\Http\Response */ public function thanaMember(StoreThanaRequest $request) { try { $response = $this->thanaRepository->thanaMember($request->all()); $this->updateStatusCode($response); return $this->respond($response); } catch (Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Remove the specified resource from storage. * * @param \App\Models\Thana $thana * @return \Illuminate\Http\Response */ public function destroy(StoreThanaRequest $request) { try { $response = $this->thanaRepository->destroyThana($request->all()); $this->updateStatusCode($response); return $this->respond($response); } catch (Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } /** * Remove the specified resource from storage. * * @param \App\Models\Thana $thana * @return \Illuminate\Http\Response */ public function thanaMakeLeader(StoreThanaRequest $request) { try { $response = $this->thanaRepository->thanaMakeLeader($request->all()); $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 getListOfSant(StoreThanaRequest $request) { try { $response = $this->thanaRepository->getListOfSant($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } }