Posts Learn Components Snippets Categories Tags About
/

How to Disable Timestamp in Laravel

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

Created on Aug 01, 2021

20 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
}

Snippets by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.

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's right for your project.

View Components

Other Code Snippets

More