think-orm icon indicating copy to clipboard operation
think-orm copied to clipboard

hasWhere无法多次使用

Open ajiho opened this issue 3 years ago • 2 comments

想根据多个模型的字段进行模糊查询数据,hasWhere只有第一次生效

Goods::where($where)
            ->hasWhere()
            ->hasWhere()

ajiho avatar Sep 17 '22 17:09 ajiho

hasWhere只能调用一次。

一个关联的查询,用hasWhere的数组条件或者闭包条件。

多个表的关联查询,直接用withJoin,然后用where表前缀查询。

where('a.status',0)->where('b.status',1)

augushong avatar Sep 19 '22 00:09 augushong

hasWhere只能调用一次。

一个关联的查询,用hasWhere的数组条件或者闭包条件。

多个表的关联查询,直接用withJoin,然后用where表前缀查询。

where('a.status',0)->where('b.status',1)

感谢。

ajiho avatar Sep 20 '22 08:09 ajiho