Skip to content

Commit 68a9b67

Browse files
committed
Fix possible bug with new locale settings
1 parent 5382616 commit 68a9b67

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Torann/GeoIP/GeoIP.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use GeoIp2\Exception\AddressNotFoundException;
1010

11+
use Illuminate\Support\Arr;
1112
use Illuminate\Config\Repository;
1213
use Illuminate\Session\Store as SessionStore;
1314

@@ -174,11 +175,18 @@ private function locate_maxmind($ip)
174175
$settings = $this->config->get('geoip.maxmind');
175176

176177
if (empty($this->maxmind)) {
177-
if ($settings['type'] === 'web_service') {
178-
$this->maxmind = new Client($settings['user_id'], $settings['license_key'], $settings['locales']);
178+
if (Arr::get($settings, 'type') === 'web_service') {
179+
$this->maxmind = new Client(
180+
Arr::get($settings, 'user_id'),
181+
Arr::get($settings, 'license_key'),
182+
Arr::get($settings, 'locales', ['en'])
183+
);
179184
}
180185
else {
181-
$this->maxmind = new Reader($settings['database_path'], $settings['locales']);
186+
$this->maxmind = new Reader(
187+
Arr::get($settings, 'database_path'),
188+
Arr::get($settings, 'locales', ['en'])
189+
);
182190
}
183191
}
184192

0 commit comments

Comments
 (0)