I've just started using the database
session driver in Laravel 5.5 along with PostgreSQL, and I've ran into a slight inconvenience.
I would like to keep the last_activity
column as timestamp with timezone
, but Laravel wants to write an integer into it, and it sometimes also attempts to delete from it based on an integer value.
I tried doing the following in my Session
model:
public function setLastActivityAttribute($ts){
$this->attributes['last_activity'] = date('c', $ts);
}
which works well for saving, but when Laravel tries to garbage collect the sessions it uses an integer value which causes a PDOException
:
SQLSTATE[22008]: Datetime field overflow: 7 ERROR: date/time field value out of range: "1506794381"
HINT: Perhaps you need a different "datestyle" setting. (SQL: delete from "sessions" where "last_activity" <= 1506794381)
Is there any way I could specify a format or intercept the process to keep the timestamptz
column type?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2x45Mdk
via IFTTT
Aucun commentaire:
Enregistrer un commentaire