protected function getData()
    {
        $ip = $this->getUserIP();
        $cacheKey = $this->cachePrefix . $ip;
        $url = $this->freegeoipUrl . '/' . $ip . '?' . '&access_key=' . config('visitlog.token') . $this->tokenString;

        // basic info
        $data = [
            'ip' => $ip,
            'browser' => $this->getBrowserInfo(),
            'os' => $this->browser->getPlatform() ?: 'Unknown',
        ];

        // info from http://freegeoip.net
        if (config('visitlog.iptolocation')) {
            if (config('visitlog.cache')) {
                $freegeoipData = unserialize(Cache::get($cacheKey));

                if (!$freegeoipData) {
                    $freegeoipData = @json_decode(file_get_contents($url), true);

                    if ($freegeoipData) {
                        Cache::forever($cacheKey, serialize($freegeoipData));
                    }
                }
            } else {
                $freegeoipData = @json_decode(file_get_contents($url), true);
            }

            if ($freegeoipData) {
                $data = array_merge($data, $freegeoipData);
            }
        }

        $userData = $this->getUser();

        if ($userData) {
            $data = array_merge($data, $userData);
        }
                
        return $data;
    }
protected function getData()
    {
        $ip = $this->getUserIP();
        $cacheKey = $this->cachePrefix . $ip;
        $url = $this->freegeoipUrl . '/' . $ip . '?' . '&access_key=' . config('visitlog.token') . $this->tokenString;

        // basic info
        $data = [
            'ip' => $ip,
            'browser' => $this->getBrowserInfo(),
            'os' => $this->browser->getPlatform() ?: 'Unknown',
        ];

        // info from http://freegeoip.net
        if (config('visitlog.iptolocation')) {
            if (config('visitlog.cache')) {
                $freegeoipData = unserialize(Cache::get($cacheKey));

                if (!$freegeoipData) {
                    $freegeoipData = @json_decode(file_get_contents($url), true);

                    if ($freegeoipData) {
                        Cache::forever($cacheKey, serialize($freegeoipData));
                    }
                }
            } else {
                $freegeoipData = @json_decode(file_get_contents($url), true);
            }

            if ($freegeoipData) {
                $data = array_merge($data, $freegeoipData);
            }
        }

        $userData = $this->getUser();

        if ($userData) {
            $data = array_merge($data, $userData);
        }
                
        return $data;
    }
protected function getData ( ) { $ ip = $ this -> getUserIP ( ) ; $ cacheKey = $ this -> cachePrefix . $ ip ; $ url = $ this -> freegeoipUrl . '/' . $ ip . '?' . '&access_key=' . config ( 'visitlog.token' ) . $ this -> tokenString ; // basic info $ data = [ 'ip' => $ ip , 'browser' => $ this -> getBrowserInfo ( ) , 'os' => $ this -> browser -> getPlatform ( ) ? : 'Unknown' , ] ; // info from http://freegeoip.net if ( config ( 'visitlog.iptolocation' ) ) { if ( config ( 'visitlog.cache' ) ) { $ freegeoipData = unserialize ( Cache :: get ( $ cacheKey ) ) ; if ( ! $ freegeoipData ) { $ freegeoipData = @ json_decode ( file_get_contents ( $ url ) , true ) ; if ( $ freegeoipData ) { Cache :: forever ( $ cacheKey , serialize ( $ freegeoipData ) ) ; } } } else { $ freegeoipData = @ json_decode ( file_get_contents ( $ url ) , true ) ; } if ( $ freegeoipData ) { $ data = array_merge ( $ data , $ freegeoipData ) ; } } $ userData = $ this -> getUser ( ) ; if ( $ userData ) { $ data = array_merge ( $ data , $ userData ) ; } return $ data ; }
Returns visit data to be saved in db.

@return array
Returns visit data to be saved in db .