locationRestrictionsRepository = $locationRestrictionsRepository; } public function get_list() { $data['locations'] = $this->locationRestrictionsRepository->getAll(); return view('subscription::setting.locations.list', $data); } public function store(LocationRestrictionFormRequest $request) { try { $this->locationRestrictionsRepository->create($request->except("_token")); LogActivity::successLog('Subscription location restriction Added.'); return response()->json(["message" => "Subscription Location Restriction Added Successfully"], 200); } catch (\Exception $e) { LogActivity::errorLog($e->getMessage()); return response()->json(["message" => "Something Went Wrong", "error" => $e->getMessage()], 503); } } public function edit($id) { try { $location = $this->locationRestrictionsRepository->find($id); return view('subscription::setting.locations.edit', compact('location')); } catch (\Exception $e) { LogActivity::errorLog($e->getMessage()); return response()->json(["message" => "Something Went Wrong", "error" => $e->getMessage()], 503); } } public function update(LocationRestrictionFormRequest $request, $id) { try { $this->locationRestrictionsRepository->update($request->except("_token"), $id); LogActivity::successLog('Subscription Location Restriction Updated.'); return response()->json([ "message" => "Subscription Location Restriction Updated Successfully", "createForm" => (string)view('subscription::setting.locations.add') ], 200); } catch (\Exception $e) { dd($e); LogActivity::errorLog($e->getMessage()); return response()->json(["message" => "Something Went Wrong", "error" => $e->getMessage()], 503); } } public function destroy($id) { try { $result = $this->locationRestrictionsRepository->delete($id); if ($result == "not_possible") { Toastr::warning(__('Unable to delete location restriction.')); return back(); } else { LogActivity::successLog('Subscription Location Restriction Deleted.'); Toastr::success(__('common.deleted_successfully'), __('common.success')); return back(); } } catch (\Exception $e) { LogActivity::errorLog($e->getMessage()); Toastr::error(__('common.Something Went Wrong')); return back(); } } }