How to only use created_at in Laravel

Stefan Izdrail

Founder & Senior Architect · 2026-06-29

Laravel Company
Title: Streamlining Laravel Timestamps: Customizing Field Names and Disabling Timestamps

In today's world where data is the new gold, managing it efficiently becomes crucial for every developer. The Laravel framework is a great tool that helps us to streamline this process by providing some built-in tools like timestamps. In this comprehensive blog post, we will explore how to manipulate these timestamps to your advantage. With just a few well-placed commands or configuration tweaks, you can customize the field names for created_at and updated_at or even disable timestamps altogether—all while ensuring data integrity.

Customizing Timestamp Field Names

const CREATED_AT = 'created';
const UPDATED_AT = 'updated';
If you need to customize the timestamp field names for your database tables, use constants as shown above. This will ensure consistency across your codebase and make it easier for others to understand your choices. These constants can be defined in either a config file or the model class itself.

In the Model:

class MyModel extends Model
{
    const CREATED_AT = 'created';
    const UPDATED_AT = 'updated';
}

Another alternative is to define them within the config/database.php file:

'default' => [
    // ... your other configuration values
    'timestamps' => true,
    'date_formats' => [
        'dateFormat' => 'Y-m-d',
        'datetypecasts' => true,
        'datetimeFormat' => 'Y-m-d H:i:s',
        'datetimeutcFormat' => 'U',
        'timeFormat' => 'H:i:s',
    ],
    // ... your other configuration values

    'custom_timestamps' => [
        'created_at' => 'created',
        'updated_at' => 'updated',
    ]
]

Note that it is essential to use the correct case for the constants since Laravel will capitalize them during execution. After defining these constants, you can use them in your model class or queries.

Disabling Timestamps

If you don't need timestamps at all, disable them by setting the $timestamps property to false:
class MyModel extends Model
{
    public $timestamps = false;
}
You can also achieve this within the config/database.php file. Set the following configuration value to false:

'default' => [
    // ... your other configuration values

    'timestamps' => true,
    'custom_timestamps' => [
        'created_at' => 'created',
        'updated_at' => 'updated',
    ]
]

This will prevent Laravel from automatically creating or updating timestamps when saving or updating your model instances. This could be useful if you already have some external system managing these timestamps, and you don't want to duplicate the effort.

Conclusion

In summary, by customizing timestamp field names or disabling timestamps altogether, you can tailor your Laravel project to fit specific data management needs. These tweaks improve your project's efficiency and help make your code more readable for future developers. Remember to use constants for name customization and keep your configuration files organized, as these practices simplify version control and collaboration among team members. For in-depth guidance on this topic and more, head over to https://laravelcompany.com/blog/.