public function getCollect()
{
return $this->belongsTo('App\Components\Misc\Models\CollectCareerTalk', 'id', 'career_talk_id');
}
public function otherMethod()
{
return $this->belongsTo('App\Components\Misc\Models\OtherMethodModel', '主键', '外键');
}
仓库:
$this->model->with(['getCollect' => function ($q) use ($user_id) {
$q->where('user_id', $user_id);
},
'otherMethod'])
->select('id', 'title')
->where([
'id' => 1
])
->first();