示例#1
0
 public function getInsertFreeAll(Request $request)
 {
     $groupsId = $request->input('groups_id');
     $dataGroup = Groups::find($groupsId);
     $datoUpdate['geocode'] = $dataGroup->customer_id;
     $hotspots_ids = json_decode($request->input('hotspots_id'), true);
     try {
         $data['groups_id'] = $groupsId;
         foreach ($hotspots_ids as $id) {
             $dataHostPot = Hostpots::find($id);
             $dataHostPot->update($datoUpdate);
             $data['hotspots_id'] = $id;
             \App\Models\HotspotsGroups::updateOrCreate($data, ['flagactive' => 1]);
         }
         $return = array('state' => 1, 'msg' => 'ok', 'data' => array());
     } catch (Exception $exc) {
         $return = array('state' => 0, 'msg' => $exc->getMessage());
     }
     return response()->json($return);
 }
示例#2
0
 public function deleteGroupsHotspots(Request $request)
 {
     try {
         $table = \App\Models\HotspotsGroups::whereGroupsId($request->get('groups', null))->whereHotspotsId($request->get('hotspots', null))->forceDelete();
         //            $data = array('hotspots_id' => $request->get('hotspots', null), 'flagactive' => '0',
         //                'groups_id' => $request->get('groups', null));
         //            $table->update($data);
         //            $table->delete();
         //            $table->forceDelete();
         $return = array('state' => 1, 'msg' => 'ok');
     } catch (Exception $exc) {
         echo '';
         exit;
         $return = array('state' => 0, 'msg' => $exc->getMessage());
     }
     return response()->json($return);
 }
 public function getDelete($id)
 {
     $table = null;
     if (!empty($id)) {
         $table = Hostpots::whereId($id);
         $table->delete();
         \App\Models\HotspotsGroups::whereHotspotsId($id)->delete();
     }
     return response()->json(array('msg' => 'ok', 'state' => 1, 'data' => null));
 }