public function deleteUser($id) { UserAction::Where('user_id', '=', $id)->delete(); UserLocation::Where('user_id', '=', $id)->delete(); User::Where('id', '=', $id)->delete(); return response()->json(["Response" => "success", "message" => "User Deleted"]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, $locationid) { // $allLocations = UserLocation::Where('location_id', '=', $locationid)->lists('user_id'); UserAction::WhereIn('user_id', $allLocations)->delete(); UserLocation::WhereIn('user_id', $allLocations)->delete(); User::WhereIn('id', $allLocations)->delete(); Location::Where('id', '=', $locationid)->delete(); return response()->json(["Response" => "success", "message" => "Location Deleted"]); }