Posts Learn Components Snippets Categories Tags Tools About
/

How to Disable Timestamp in Laravel

Learn how to disable timestamp (created_at and updated_at) in Laravel

Created on Aug 01, 2021

409 views

To disable the timestamp of your Laravel model you can specify the "$timestamps" value to "false". By doing so it will let Laravel know that the timestamp is not necessary for the Eloquent instance.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    public $timestamps = false; # disable created_at and updated_at
}

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for How to Disable Timestamp in Laravel

new

PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.

View Components

Sponsors 👑

+ Add Yours
)