How Can I put data into the table in Laravel API?

I have a database that was given to me, and I need to build an API on it
but the columns in the table don’t have a created_at or updated_at column. Every time I put code into the runtime it gives me this error.

SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘updated_at’ in ‘field list’


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

set timestamps to false for example:

class Post extends Model
    public $timestamps = false;


Method 2

Set public $timestamps to false in your model, and also remove it from your database migration

remove this line


appendix to

whichever suits you the best. If you think you’ll change your mind later, you could set it to nullable.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x