Skip to content

Commit 91c1b1d

Browse files
amandiobmAmandio Magalhaes
and
Amandio Magalhaes
authored
Merged config files to prevent failures (jamesmills#28)
Co-authored-by: Amandio Magalhaes <[email protected]>
1 parent 6393d20 commit 91c1b1d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/LaravelTimezoneServiceProvider.php

+5
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,10 @@ function ($expression) {
7070
public function register()
7171
{
7272
$this->app->bind('timezone', Timezone::class);
73+
74+
$this->mergeConfigFrom(
75+
__DIR__ . '/config/timezone.php',
76+
'timezone'
77+
);
7378
}
7479
}

src/Listeners/Auth/UpdateUsersTimezone.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public function handle(Login $event)
1818
$ip = $this->getFromLookup();
1919
$geoip_info = geoip()->getLocation($ip);
2020

21-
if (auth()->user()->timezone != $geoip_info['timezone']) {
22-
if (config('timezone.overwrite') == true || auth()->user()->timezone == null) {
23-
$user = auth()->user();
21+
$user = auth()->user();
22+
if ($user->timezone != $geoip_info['timezone']) {
23+
if (config('timezone.overwrite') == true || $user->timezone == null) {
2424
$user->timezone = $geoip_info['timezone'];
2525
$user->save();
2626

@@ -70,7 +70,7 @@ public function notify(\Torann\GeoIP\Location $geoip_info)
7070
return;
7171
}
7272
}
73-
73+
7474
/**
7575
* @return mixed
7676
*/

0 commit comments

Comments
 (0)