DatabaseServiceProvider: Use timezone from config (was not set before)

This commit is contained in:
Igor Scheller 2019-10-13 20:34:13 +02:00
parent c0e97bfe75
commit 9921c5002a
1 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@ class DatabaseServiceProvider extends ServiceProvider
{ {
$config = $this->app->get('config'); $config = $this->app->get('config');
$capsule = $this->app->make(CapsuleManager::class); $capsule = $this->app->make(CapsuleManager::class);
$now = Carbon::now($config->get('timezone'));
$dbConfig = $config->get('database'); $dbConfig = $config->get('database');
$capsule->addConnection(array_merge([ $capsule->addConnection(array_merge([
@ -25,7 +26,7 @@ class DatabaseServiceProvider extends ServiceProvider
'password' => '', 'password' => '',
'charset' => 'utf8', 'charset' => 'utf8',
'collation' => 'utf8_unicode_ci', 'collation' => 'utf8_unicode_ci',
'timezone' => Carbon::now()->format('P'), 'timezone' => $now->format('P'),
'prefix' => '', 'prefix' => '',
], $dbConfig)); ], $dbConfig));