join+where 多表查询

浏览:1298 发布日期:2018/04/07 分类:ThinkPHP5专区 关键字: join + where
我现在有两个表user和order user表中的id关联order表中的uid
在后台管理中我将uid重新赋值为user表中的userName 展示为中文名字$list = Db::table('order')->order('id')->paginate(15)->each(function($item, $key){
            $user = Db::table('user')->where('id='.$item['uid'])->find();
            $goods = Db::table('goods')->where('id='.$item['goodsId'])->find();
            $item['uid'] = $user['userName'];
            $item['goodsId'] = $goods['goodsName'];
            return $item;
        });

现在我想通过模糊搜索人名 达到搜索订单的效果怎么弄?
最佳答案
评论( 相关
后面还有条评论,点击查看>>