Laravel Set Model Timestamps False

Admin   Laravel   343  2021-03-17 16:20:06

Hi Dev,

In this article I will teach you how to set model timestamps false in laravel. set timestamps false into model in laravel. You can easy to understand and how to use it.

Sometimes we require to disable created_at and updated_at timestamps on Model on Laravel, so we can do it simply by using.

$timestamps variable of model and set into false. You can create new item or user using model at that time created_at and updated_at set default.

I am creating new records using create method of model like as bellow example:

Blog::create(['title' => '']); 

Ok, above code will simple to add new records on blogs table with current timestamps value in created_at and updated_at.example as bellow




namespace App;

use Illuminate\Database\Eloquent\Model;

class Item extends Model


public $fillable = ['title'];

public $timestamps = false;


It will help you...