Disable Model Timestamps in Laravel Example

Laravel Disable Model Timestamps Example; In this tutorial you will learn how to disable default created_at and updated_at timestamps in laravel from model.

Laravel predefined funcation $table->timestamps() generate created_at and updated_at column automatically, and when the record is created or update the created_at and update_at column values inserted. But if you want to disable the created_at and updated_at your just need to timestamps false in your model.

Simply place this line in your Model:

public $timestamps = false;

Example:

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    public $timestamps = false;
}

I hope this example works for you.

Leave a Comment