When creating a BelongsToMany Relationship and then trying to delete all related models, it fails with:
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'updated_at' in field list is ambiguous (SQL: update `group` inner join `user_group` on `group`.`id` = `user_group`.`group_id` set `group`.`deleted_at` = 2017-02-27 21:04:25, `updated_at` = 2017-02-27 21:04:25 where `user_group`.`user_id` = 1 and `group`.`deleted_at` is null)
$this->x()->delete();
$this->y()->delete();
Both queries fail with the ambiguous updated_at. If you look at the error you can see the missing group. in front of updated_at.
Edit:
When i execute ->forceDelete() instead of ->delete() it works like a charm.
Thanks!
Duplicate of https://github.com/laravel/framework/issues/13909
Thanks!
Most helpful comment
Duplicate of https://github.com/laravel/framework/issues/13909