使用eloquent连接不从连接表中获取公共列

时间:2014-12-29 09:56:58

标签: laravel eloquent

我正在加入两个都有tag_id的表(即album.tag_id和photo.tag_id)

function GetJoined() 
{
    return Album::join('photos', 'photos.tag_id', '=', 'albums.tag_id')
}

但我不希望结果查询一直提醒我这是两个表的连接

GetJoined()->where('tag_id', 1);

将会像

一样
'tag_id' in where clause is ambiguous

有什么建议吗?

0 个答案:

没有答案
相关问题