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
in AppServiceProvider
public function register()
{
// For example im gonna locale all dates to Indonesian (ID)
config(['app.locale' => 'id']);
\Carbon\Carbon::setLocale('id');
}
then to make locale output do something like this
// Without locale, the output gonna be like this
Carbon\Carbon::parse('2019-03-01')->format('d F Y'); //Output: "01 March 2019"
// With locale
Carbon\Carbon::parse('2019-03-01')->translatedFormat('d F Y'); //Output: "01 Maret 2019"
For more information about converting localize dates you can see on below link https://carbon.nesbot.com/docs/#api-localization