fastadmin关联查询

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

$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();

  

php开发交流群: 87710564
原文地址:https://www.cnblogs.com/wangdeguao/p/13230571.html