/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $repair = Repair::where('user_id', Auth::user()->id)->find($id);
     if ($repair === null) {
         return response()->json(['status' => 2]);
     }
     $repair->status = Category::getCategoryId('repair.status', 'canceled');
     $result = $repair->save();
     return response()->json(['status' => $result === true ? 0 : 2]);
 }
 /**
  * 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]);
 }