Coffee
Coffee

Reputation: 2233

Eloquent Model adding row without "created_at" and "updated_at" fields

So in my SQL I have table that contains only three fields -- row id, person id and status id, and I want to add new rows using Laravel models, and when I use

$a = new AssignedStatus;
$a->person_id = $person_id;
$a->status_id = $status_id;
$a->save();

I get SQL error telling that columns "created_at" and "updated_at" are not found in this table. Is it somehow possible to get rid of them and just insert row, or is it easier to use DB::table connection?

Upvotes: 2

Views: 2721

Answers (1)

Farkie
Farkie

Reputation: 3337

In AssignedStatus model you need to declare:

public $timestamps = false

Upvotes: 9

Related Questions