I am trying to change/format created_at
and updated_at
fields created by laravel when timestamps are set to true in its model.
suppose if the value is '2016-10-08' i want it to change as '2016-أكتوبر-08'
Is there a way to customise the way they are stored in the database.
I 've tried setting the locale in app.php,
'locale' => 'ar',
Try adding this Eloquent Mutator to your model to override the base model using your set locale value (ar
as defined in your app.php
):
protected function asDateTime($value)
{
return (parent::asDateTime($value))->setLocale(App::getLocale());
}