How to prevent Eloquent from adding created_at or updated_at timestamps?

October 26, 2018

If you want to disable both created_at and updated_at then add this to your model:

<?php
const UPDATED_AT = null;
const CREATED_AT = null;

If you want to disable just one of those fields (i.e. turn off created_at but keep updated_at, or keep created_at but disable the updated_at field) then just add the one line as required.

Also remember to remove this from the migrations:

<?php
$table->timestamps()

Note: There is also the DELETED_AT const, if you use SoftDeletes.