public function scanRegion($region_id, $category = false) { if (!$region_id) { // die('Please provide region id'); return false; } if ($category) { $this->active_category = $category; } $Region = \Model_Tracking_Region::find($region_id); if (!$Region) { // die('Region not found'); return false; } // get all tracking points of this location $Points = \Model_Tracking_Point::query()->where('region_id', $region_id)->where('scanned', '!=', 1)->limit(300)->get(); $this->debugMessage('Loaded ' . count($Points) . ' tracking points for region "' . $Region->name . '" from database.'); foreach ($Points as $Point) { // this script is not for updating, just first time adding points, so just skip if scanned once. if ($Point->scanned) { $this->debugMessage('Skipped ' . $Point->lat . ',' . $Point->lng); continue; } $this->searchForLocations($Point->lat, $Point->lng, 200, '', $region_id); // scan complete.. $Point->scanned = 1; $Point->save(); } return true; }
public function action_delete($id = null) { is_null($id) and Response::redirect('Tracking_Region'); if ($tracking_region = \Model_Tracking_Region::find($id)) { $tracking_region->delete(); Session::set_flash('success', 'Deleted tracking_region #' . $id); } else { Session::set_flash('error', 'Could not delete tracking_region #' . $id); } Response::redirect('tracking/region'); }