public function run($request)
 {
     // Try to geocode a sample address
     $address = Geocoder::config()->local_address;
     // Test simple geocoding
     $geo = Geocoder::simpleGeocode($address);
     DB::alteration_message("Testing general behaviour");
     if ($geo) {
         DB::alteration_message('Simple geocoding is working ' . $geo['Latitude'] . '/' . $geo['Longitude'], 'created');
     } else {
         DB::alteration_message('Simple geocoding failed', 'error');
     }
     // Test all providers
     $geocoder = Geocoder::getGeocoder();
     $list = array_keys($geocoder->getProviders());
     DB::alteration_message("Registered providers are : " . implode(',', $list));
     foreach ($geocoder->getProviders() as $name => $provider) {
         DB::alteration_message("Testing : " . $name);
         try {
             $res = $geocoder->using($name)->geocode($address);
             if ($res->count()) {
                 DB::alteration_message("Provider {$name} is working and returned " . $res->count() . ' results', 'created');
                 foreach ($res as $result) {
                     DB::alteration_message('Geoloc is working ' . $result->getLatitude() . '/' . $result->getLongitude(), 'created');
                 }
             } else {
                 DB::alteration_message("Provider {$name} failed to geocode address", 'error');
             }
         } catch (\Geocoder\Exception\NoResult $ex) {
             DB::alteration_message("Provider {$name} failed to geocode address", 'error');
             DB::alteration_message($ex->getMessage(), 'error');
         } catch (\Exception $ex) {
             DB::alteration_message($ex->getMessage(), 'error');
         }
     }
 }
 /**
  * Get the ip of the client
  *
  * @return string
  */
 public static function getRealIp()
 {
     if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         $ip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
         $ip = array_pop($ip);
     } elseif (!empty($_SERVER['HTTP_CLIENT_IP'])) {
         $ip = $_SERVER['HTTP_CLIENT_IP'];
     } elseif (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) {
         $ip = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
     } elseif (!empty($_SERVER['REMOTE_ADDR'])) {
         $ip = $_SERVER['REMOTE_ADDR'];
     }
     // To test behaviour, it might be useful to return something else than local ip
     if ($ip == '127.0.0.1') {
         return Geocoder::config()->local_ip;
     }
     if (isset($ip) && filter_var($ip, FILTER_VALIDATE_IP) !== false) {
         return $ip;
     }
     return '0.0.0.0';
 }