Laravel Disable Timestamps

Suppose, your database table does not have created_at, updated_at fields and you are trying to create or update a record with the eloquent model. In this situation, you will get an error for those fields.

To solve the issue, just add this line in your model:

public $timestamps = false;

An example:

class Product extends Model
    use HasFactory;

    public $timestamps = false;

You can take a look at the video: