0
我正在开发一个项目laravel 5.2
。但现在我有一个问题,在我的数据库中,有两个表users
和comments
。 users
表包含id, email, username, password, created_at, updated_at
列。 comments
表格包含id, user_id, content, created_at, updated_at, deleted_at
。现在在我的代码中,我有一个array
,其中包含一些注释ID。我想获得users
谁拥有这些意见。所以这里是我的代码:Laravel 5.2 where列表不明确
$commentIds = [
....
...
...
];
$users = User::whereHas('comments',function($query)use($commentIds){
$query->whereIn('id',$commentIds);
});
但我得到异常说,列ID是不明确的。
我们展示users'和'comments''之间的关系。 –