/** * Update the repair list's status to finished * and also update the aim property to status -normal. * * @param Request $request * @return Json */ public function update(Request $request) { // get repair list $repair_list = $request->input('repair_list'); if (!is_array($repair_list)) { return response()->json(['status' => 2]); // paramater error. } $property_list = Repair::whereIn('id', $repair_list)->get()->pluck('property_id'); // update repair status $affect_repairs = Repair::whereIn('id', $repair_list)->update(['status' => Category::getCategoryId('repair.status', 'finished')]); return response()->json(['status' => 0]); }