How to remove "updated_at" while keeping the "created_at" in Eloquent ORM Laravel
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
How to Remove updated_at While Keeping created_at in Eloquent ORM Laravel
As a senior developer working with the Laravel ecosystem, managing model attributes and database timestamps is a common task. Often, when we initialize a new model, Eloquent automatically adds created_at and updated_at fields to track record history. However, situations arise where you only need creation time for auditing purposes, and the automatic update timestamp (updated_at) becomes redundant or undesirable.
The challenge here is specifically: How do we suppress the management of the updated_at field while ensuring the essential created_at field remains intact?
This guide will walk you through the most effective, developer-centric ways to handle this scenario in Laravel Eloquent, providing practical solutions and best practices.
Understanding Eloquent Timestamps
By default, any model using the timestamps() macro is configured to automatically manage these two columns. When you save a model instance ($model->save()), Eloquent handles setting both timestamps based on your configuration.
// Example of a standard model setup
class Post extends Model
{
use HasFactory, Timestamps; // This enables created_at and updated_at
}If you simply want to eliminate the management of updated_at, we need to intervene in how Eloquent interacts with the database layer. Simply dropping a column via migration would violate your requirement of keeping created_at. Therefore, we must use Eloquent features to control this behavior.
Solution 1: Disabling Timestamps on Specific Models (The Cleanest Approach)
If you have models where timestamps are not relevant—and you only care about the creation time—the most straightforward solution is to explicitly tell Eloquent not to manage these fields for that specific model by removing the timestamps() trait.
However, since you specifically need created_at, we can achieve this by manually defining the attributes and ensuring our saving logic respects this structure. A more robust method involves overriding the model's behavior if you are using custom database structures.
The most effective way to manage timestamps granularly is often through mutators and accessors, or by strictly controlling which fields are mass-assignable.
Solution 2: Controlling Attributes via Model Properties
Instead of relying on the automatic timestamps() behavior, we can define our model attributes explicitly and handle the saving process manually, ensuring only the necessary data is persisted. This gives you complete control over what gets written to the database, which is crucial when dealing with custom requirements beyond standard CRUD operations.
If you are working on complex data structures where timestamps are secondary concerns, focus on defining your fields without inheriting the full timestamp functionality:
use Illuminate\Database\Eloquent\Model;
class MyCustomModel extends Model
{
// Do NOT use use Timestamps; unless you need both fields managed automatically.
protected $fillable = [
'name',
'description',
// 'updated_at' is intentionally omitted here
];
// You can still define created_at if it exists in the database schema
// but Eloquent will no longer attempt to manage updated_at automatically.
public function save()
{
$this->fillable = [
'name',
'description',
];
$this->save();
}
}By explicitly defining $fillable and controlling the save() method, you ensure that only the fields you explicitly permit are saved. If your database schema contains both columns, this approach prevents Eloquent from attempting to write or manage the updated_at field during standard operations, thus achieving your goal of removing its automatic management while preserving created_at.
Conclusion and Best Practices
When working with Eloquent, remember that the magic lies in configuration. While Laravel provides powerful defaults through traits like timestamps(), complex requirements necessitate overriding this behavior. For scenarios where you need granular control over database columns—like keeping created_at but eliminating updated_at management—explicitly defining $fillable properties and custom saving logic is the most reliable pattern.
Always ensure your database migrations reflect exactly what your Eloquent models expect, as outlined in best practices detailed by resources like laravelcompany.com. By taking manual control over data persistence, you build more resilient and predictable applications.