chaturmasRepository = $chaturmasRepository; } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(GetChaturmasRequest $request) { try { $response = $this->chaturmasRepository->getChaturmasList($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 App\Http\Requests\Api\Chaturmas\StoreChaturmasRequest $request * @return \Illuminate\Http\Response */ public function store(StoreChaturmasRequest $request) { try { $response = $this->chaturmasRepository->storeChaturmas($request->all()); $this->updateStatusCode($response); $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\Chaturmas $chaturma * @return \Illuminate\Http\Response */ public function show(Chaturmas $chaturma) { try { $response = $this->chaturmasRepository->showChaturmas($chaturma); $this->updateStatusCode($response); $this->setStatusCode($response['status']); } catch (Exception $ex) { $response['error'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * Update the specified resource in storage. * * @param App\Http\Requests\Api\Chaturmas\UpdateChaturmasRequest $request * @param \App\Models\Chaturmas $chaturma * @return \Illuminate\Http\Response */ public function update(UpdateChaturmasRequest $request, Chaturmas $chaturma) { try { $response = $this->chaturmasRepository->updateChaturmas($request->all(), $chaturma); $this->updateStatusCode($response); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['error'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * Remove the specified resource from storage. * * @param \App\Models\Chaturmas $chaturma * @return \Illuminate\Http\Response */ public function destroy(Chaturmas $chaturma) { // } /** * Display the specified resource. * * @param \App\Models\Chaturmas $chaturma * @return \Illuminate\Http\Response */ public function getChaturmasYears() { try { $response = $this->chaturmasRepository->getChaturmasYears(); $this->updateStatusCode($response); $this->setStatusCode($response['status']); } catch (Exception $ex) { $response['error'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * Display the specified resource. * * @param \App\Models\Chaturmas $chaturma * @return \Illuminate\Http\Response */ public function getHundredChaturmasYears() { try { $response = $this->chaturmasRepository->getHundredChaturmasYears(); $this->updateStatusCode($response); $this->setStatusCode($response['status']); } catch (Exception $ex) { $response['error'] = $ex->getMessage(); $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } }