Just migrate your database, and add $dates property to your Model.
protected $dates = ['custom_created_at_field', 'custom_updated_at_field'];
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm in the process of migrating an existing application over to laravel and I ran into problems with the created_at and updated_at tables. The database that I'm currently using already has these fields, but they're named differently. I can override $primaryKey, but not the timestamp fields. Is there a purpose for this?
here's the code in Illuminate\Database\Eloquent\Model.php
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'created_at';
/**
* The name of the "updated at" column.
*
* @var string
*/
const UPDATED_AT = 'updated_at';
Please or to participate in this conversation.