In my service provider boot()
I have the following:
config([
'app.name' => 'Elephant',
'app.url' => 'http://elephant.dev',
'app.timezone' => 'America/Toronto',
]);
app.name
and app.url
both work fine, but app.timezone
does not work. My configuration is NOT cached.
I'm saying it does not work because when I create()
a record in the database, it is still using UTC
for the created_at
column and not America/Toronto
.
Why is this happening and how to I make it work?
Make an environment variable in .env
file
APP_TIMEZONE='America/Toronto'
and then in config/app.php
set timezone to this
'timezone' => env('APP_TIMEZONE', 'UTC'),
If this is not solving the problem then just post in comment and I will delete the answer.