setToStringFormat()
works here for all model dates, default or custom. Not sure what goes wrong on your end.
Eloquent model shouldn't really change the output of the carbon object, only creates it for date fields.
ps.: You should use a base model, so you don't have to modify in every model in similar cases.
Hi Sam, i am having similar trouble,
i have registered it as an alias in the app config file, but still no luck.
carbon functions perfectly in any other way but where ever i use
Carbon::setToStringFormat('d/m/Y');
it dosn't seem to work
Cheers
Oli
i seem to have made a bit of progress on this,
that carbon output is only provided by the model when you specifically access the date field:,
$modelName->dateField.
if you just dump the query response straight into an array and output it as json the carbon conversion is never called.
Oli
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community