Reputation: 304
I have two models User
and Role
i have turned off timestamps for both of them like so
public static $timestamps=false
and also i have removed the created_at
and updated_at
columns from both the tables(users
& roles
).
I also have a 3rd pivot table called role_user
with 3 columns id
,user_id
and role_id
when i try find the role of a user i keep getting Column unknown role_user.created_at
not found.`
Please Help am stuck with this problem. thank you in advance!
Upvotes: 0
Views: 732
Reputation: 15673
I have just had the same problem. Fixed it by adding:
Laravel\Database\Eloquent\Pivot::$timestamps = false;
to application/start.php
Upvotes: 0
Reputation: 1135
In pivot tables the timestamps are essential. The datatype for timestap is datetime.
Upvotes: 0
Reputation: 4888
In laravel 3 pivot tables needs to have a time stamp. Either add this line to you migrations: $table->timestamps() or create the columns manually. I believe the column type is datetime for both the created_at and updated_at columns.
Upvotes: 2