首先在方法开始处开启关联查询

$this->relationSearch = true; //开启关联查询

 

然后在模型里面添加方法

public function adminInfo(){
     return $this->belongsTo('Admin', 'uid', 'id', [], 'LEFT')->setEagerlyType(0);
}

最后修改查询方法添加with

$list = $this->model->with('adminInfo')
                ->where($where)
                ->order($sort, $order)
                ->limit($offset, $limit)
                ->select();

  

相关文章:

  • 2021-12-24
  • 2021-06-15
  • 2021-06-27
  • 2021-11-07
  • 2022-12-23
  • 2021-11-23
猜你喜欢
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2021-11-30
相关资源
相似解决方案