Hello !
You can customize the timestamp format by using:
protected $dateFormat = 'U'; // any format from Carbon
in your eloquent model class !
https://laravel.com/docs/5.4/eloquent-mutators#defining-an-accessor
I would like to translate the default display from $model->created_at to Portuguese. Is that possible?
In my config/app.php I have:
'locale' => 'pt',
In my pt lang folder I have these three files:
auth.php
pagination.php
passwords.php
validation.php
Where do I place the translation to Carbon instances?
@ouhare that doesn't change the language used, only the format of the date. Like it will still output "Sunday" for the day of the week instead of "Domingo".
@brunofrancisco In your AppServiceProvider's register() method, you can add:
Carbon::setLocale(config('app.locale'));
Then everything should be in Portuguese globally when outputting carbon dates.
Please or to participate in this conversation.