示例#1
0
 /**
  * Update the creation and update ips.
  *
  * @return void
  */
 protected function updateIps()
 {
     $ip = smart_get_client_ip();
     if (!$this->isDirty('updated_ip')) {
         $this->updated_ip = $ip;
     }
     if (!$this->exists && !$this->isDirty('created_ip')) {
         $this->created_ip = $ip;
     }
 }
示例#2
0
 function ip_to_country_iso_code($ip = null, $default_iso_code = 'US')
 {
     if (empty($ip)) {
         $ip = smart_get_client_ip();
     }
     $location = \GeoIP::getLocation($ip);
     // check if NOT returned default
     if ($location['default'] === false && !empty($location['isoCode'])) {
         return $location['isoCode'];
     } else {
         return $default_iso_code;
     }
 }