public function postEdit(Request $request, $id) { $province = $this->provinceRepository->findById($id); $province->active = $request->input('active'); if ($request->input('active') == null) { $article->active = false; } $province = $this->provinceRepository->createOrUpdate($province); District::whereProvinceId($id)->update(['active' => 0]); District::whereProvinceId($id)->whereIn('id', $request->input('ids'))->update(['active' => 1]); return response()->json(['error' => false, 'message' => trans('notices.update_success_message')]); }
/** * @param $id */ public function getChangeProvince($id) { $districts = District::whereProvinceId($id)->whereActive(1)->select('name', 'id')->get(); return response()->json(['error' => false, 'data' => $districts]); }