首页 > 其他 > 详细

fastadmin关联查询

时间:2020-07-03 16:16:38      阅读:97      评论:0      收藏:0      [点我收藏+]

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

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

  

fastadmin关联查询

原文:https://www.cnblogs.com/wangdeguao/p/13230571.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!