lundi 20 janvier 2020

Override created_at value from Eloquent models, without disabling timestamps

In Laravel, is it possible to override the value for created_at values for a given Eloquent model?

The use case, is that I have the User model with a timezone column (e.g. America/Chicago). The app stores date values in UTC and for one user I'd like to transform the date to the timezone related.

I tried to use getCreatedAtAttribute but it doesn't work.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire