Rename or change default timestamps created_at, updated_at – Laravel

Rename or change default timestamps created_at, updated_at – Laravel

Best method to change Laravel’s default timestamps:

Step 1: Override const in specific model like:

const CREATED_AT = ‘created’;
const UPDATED_AT = ‘updated’;

Then getCreatedAtColumn  and  getUpdatedAtColumn Methods will return newly assigned names

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *