-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel + Postgresql timestamp with timezone #15
Comments
👍 |
Are there any updates on this issue ? We're facing the same problem. |
I had forgotten about this. You can actually create a subclass of the Pivot class and set the timestamp format there. Then in a subclass of Laravel Model class you can override the newPivot method to return an instant of your own Pivot. It's a bit of a mess to get working, but it should do the job. We've actually moved away from using pivots at all and instead give the Pivot tables their own eloquent model class since it's just easier to work with them that way. |
any update? |
You just need to set your
|
shows below error :The timezone could not be found in the database |
Using Postgres
timestamp with time zone
column with Laravel causes an issue with CarbonThis is because the data returned by Postgres include the
+00
timezone information on the end. One fix would be to overridegetDateFormat
and have it return'Y-m-d H:i:sO'
but of course we'd only want to do that where timezones are being used.Models can override their own
dateFormat
property, but pivot tables with timestamps can't do this (since there's no actual model for them).The text was updated successfully, but these errors were encountered: