Laravel Timezone setting

Add TIMEZONE to .env file

.env

TIMEZONE="Asia/Hong_Kong"

Modify the config/app.php to using the TIMEZONE env variable.

// "timezone" => "UTC",
"timezone" => env("TIMEZONE", "UTC"),  //replace

Modify config/database.php to using the TIMEZONE env variable.

'connections' => [
    'mysql' => [
        'driver' => 'mysql',
        //...
        'timezone' => today(env("TIMEZONE", "UTC"))->format("P"), // append this config
    ]
]