diff --git a/src/App/Http/Traits/IpAddressDetails.php b/src/App/Http/Traits/IpAddressDetails.php index e02a27c..7d2d286 100644 --- a/src/App/Http/Traits/IpAddressDetails.php +++ b/src/App/Http/Traits/IpAddressDetails.php @@ -38,8 +38,9 @@ public static function checkIP($ip = null, $purpose = 'location', $deep_detect = 'NA' => 'North America', 'SA' => 'South America', ]; - if (filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) { - $ipdat = @json_decode(file_get_contents('http://www.geoplugin.net/json.gp?ip='.$ip)); + if (config('LaravelLogger.enableGeoPlugin', true) && filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) { + $geopluginUrl = config('LaravelLogger.geoPluginUrl', 'http://www.geoplugin.net/json.gp?ip='); + $ipdat = @json_decode(file_get_contents($geopluginUrl.$ip)); if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) { switch ($purpose) { case 'location': diff --git a/src/config/laravel-logger.php b/src/config/laravel-logger.php index 9b37ff9..ec2a703 100644 --- a/src/config/laravel-logger.php +++ b/src/config/laravel-logger.php @@ -176,4 +176,8 @@ // LiveSearch for scalability 'enableLiveSearch' => env('LARAVEL_LOGGER_LIVE_SEARCH_ENABLED', true), + // GeoPlugin for IP lookup + 'enableGeoPlugin' => env('LARAVEL_LOGGER_GEO_PLUGIN_ENABLED', true), + 'geoPluginUrl' => env('LARAVEL_LOGGER_GEO_PLUGIN_URL', 'http://www.geoplugin.net/json.gp?ip='), + ];