Beispiel #1
0
 public function update($latitude = null, $longitude = null)
 {
     $latitude = empty($_GET['lat']) ? $latitude : $_GET['lat'];
     $longitude = empty($_GET['lng']) ? $longitude : $_GET['lng'];
     if (!empty($latitude) && !empty($longitude)) {
         $newLocation = $this->api->revgeocode($latitude, $longitude);
         $point = new Point();
         $point->setLat($latitude);
         $point->setLng($longitude);
         $this->location->setPoint($point);
         if (!empty($newLocation)) {
             $this->location->setAddress($newLocation);
         }
         if ($this->isSessionEnabled) {
             $this->location->save();
         }
     }
     $success = (bool) $this->location->getPoint();
     $location = $this->location->toJson();
     return compact("success", "location");
 }