/** * Handle the driver request. * * @param string $ip * * @return Position|bool */ public function get($ip) { $location = $this->process($ip); if (!$location && $this->fallback) { $location = $this->fallback->get($ip); } if ($location instanceof Fluent) { $position = $this->hydrate(new Position(), $location); $position->driver = get_class($this); return $position; } return false; }
/** * Retrieve the users location. * * @param string $ip * * @return \Stevebauman\Location\Position|bool */ public function get($ip = '') { if (session()->has($this->key)) { return session($this->key); } if ($location = $this->driver->get($ip ?: $this->getClientIP())) { // We'll store the location inside of our session // so it isn't retrieved on the next request. session([$this->key => $location]); return $location; } return false; }