What does the result of trim($payload['data']['object']['current_period_end']) look like?
Dec 15, 2024
5
Level 2
Trailing data {"exception":"[object] (Carbon\\Exceptions\\InvalidFormatException(code: 0): The separation symbol could not be found
I don't understand what is causing this issue. In my model, I have the membership_expiry cast as a datetime
protected $casts = [
'membership_expiry' => 'datetime',
'email_verified_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];
and in my function, I convert a UNIX timestamp received from an API call to a Carbon object but when I try to save that Carbon object to the database it throws this error. I have tried formatting it as a DateTime string ('Y-m-d H:i:s') or just saving it as the Carbon object in the raw.
$date = Carbon::createFromTimestamp(trim($payload['data']['object']['current_period_end']));
$user->membership_expiry = $date;
both ways throw this error.
Level 122
You sure you don't have a mutator in your model?
Please or to participate in this conversation.