get() публичный Метод

Handle the driver request.
public get ( string $ip ) : Position | boolean
$ip string
Результат Stevebauman\Location\Position | boolean
Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * 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;
 }