Laravel 5 Carbon global Locale

前端 未结 3 1169
有刺的猬
有刺的猬 2020-12-10 12:28

I\'m trying to set the same global locale of laravel which is :

config(\'app.locale\')

to work with Carbon.

It seems like you can d

3条回答
  •  忘掉有多难
    2020-12-10 13:11

    I configured it in the AppServiceProvider.

    class AppServiceProvider extends ServiceProvider
    {
        public function boot()
        {
            // Localization Carbon
    
            \Carbon\Carbon::setLocale(config('app.locale'));
        }
    }
    

提交回复
热议问题