Reputation:
In order to force my Eloquent Models to output dates in unix-timestamp (not string formatted) when serialized with toJson() method, I have overridden the $dateFormat attribute as the following:
$dateFormat = 'U;
This seems to be the recommended way to change how Date attributes are outputted. (Please check this question). But I'm getting the following errors by doing so.
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Trailing data' in ...\vendor\nesbot\carbon\src\Carbon\Carbon.php on line 425
Followed by this one:
InvalidArgumentException: Trailing data in ...\vendor\nesbot\carbon\src\Carbon\Carbon.php on line 425
What am I doing wrong?
Upvotes: 3
Views: 1125