在 Laravel 5.7 設置時區

修改 app\Providers\AppServiceProvider.php 檔:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
namespace App\Providers;

use Carbon\Carbon;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
date_default_timezone_set('Asia/Taipei');
}

/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}