场景
一对多关联
Knowledge表的 ID
关联
Question表的chapterid
Knowledge模型
public function profile()
{
return $this->hasMany('Question','chapterid','id');
}调用$Knowledge_obj->with('profile')->where($where)->order('id asc')->page($page,$limit)->select();不添加关联模型条件完全OK$Knowledge_obj->hasWhere('profile',['status'=>1])->where($where)->order('id asc')->page($page,$limit)->select();添加关联模型条件查出的结果不出现子数据profile请问下各路大神 是不是哪里打开方式有误
最佳答案