【发布时间】:2019-09-23 06:00:11
【问题描述】:
owner 它是 bulletins 表的一列,它是对话模型中的关系。
public function bulletin()
{
return $this->belongsTo('App\Bulletins','bulletin_id');
}
$conversations = Conversations::with('bulletin','messages')
->where('owner_id', $userId)
->orWhere('owner', $userId)
->get();
我有未知的列所有者。我知道这是什么意思,但是如何在 laravel 中做到这一点?之前我使用 left join 来处理这个请求,现在我想使用 eloquent 关系。
【问题讨论】: