Reputation: 25
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'
Upvotes: 0
Views: 155
Reputation: 610
Set public $timestamps to false in your model, and also remove it from your database migration
remove this line
$table->timestamps();
or
appendix to
$table->timestamps()->nullable();
whichever suits you the best. If you think you'll change your mind later, you could set it to nullable.
Upvotes: 0
Reputation: 306
set timestamps to false for example:
class Post extends Model
{
public $timestamps = false;
//
}
Upvotes: 1