Laravel models manages the datetime attributes of a model converting them to a Carbon date instance. The model knows which fields have a date type using the $dates attribute of the model instance. The name is pretty descriptive, is a list that contains the name of each field in the model that will be converted to Carbon when is got. If the DB contains an invalid value not recognized by Carbon, we will encounter the error:

ErrorException (E_UNKNOWN)
Trailing data

Provoked by an InvalidArgumentException thrown previously by Carbon.

In mi case, the problem was a DB record inserted manually, outside the app. This record had a date with a Carbon invalid format, but valid and correct for PostgreSQL:

2014-08-26 06:50:01.997969

The solution was simple, removing the milliseconds part because in my case it’s negligible.