did yu test
use Carbon\Carbon;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
So I have a Sequelize Postgres database that I am trying to migrate to a Laravel project (5.6+). Its created_at and updated_at uses timestamp with timezone so one of the columns looks like this: 2018-06-08 20:25:46.184-05
The problem is trying to update the updated_at column because Carbon fails due to the way it parses timestamps with milliseconds.
(and yes, I have tried those solutions.)
Here is the error when my model tries to update its timestamp of updated_at column:
InvalidArgumentException Trailing data
And here is my modal:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Books extends Model
{
public $table = 'public.Books';
// Postgres to conform to Carbon instances
protected $dateFormat = 'Y-m-d H:i:s.u';
const CREATED_AT = 'createdAt';
const UPDATED_AT = 'updatedAt';
protected $primaryKey = 'uuid';
protected $guarded = [''];
}
How do I make my model (Laravel / Carbon) accept the current column type of timestamp with timezone?
Please or to participate in this conversation.