You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
升级后查询范围置后了,会之前没写闭包的or查询出现问题
比如:
User::scope('zuhu')->whereOr([['name','like','%'.$keyword.'%'],['email','like','%'.$keyword.'%'],['mobile','like','%'.$keyword.'%']])->select();
最终的语句是
SELECT * FROM user WHERE ( name LIKE '%12345678901%' OR email LIKE '%12345678901%' OR mobile LIKE '%12345678901%' AND zuhu_id = '1' ),
以前的语句是
SELECT * FROM user WHERE zuhu_id = '1' AND ( name LIKE '%12345678901%' OR email LIKE '%12345678901%' OR mobile LIKE '%12345678901%')
为啥要把scope条件置后呢?
The text was updated successfully, but these errors were encountered:
feelec-yishu
changed the title
升级后查询范围置后了,会之前没写闭包的or查询出现问题
升级后查询范围置后了,如果之前没写闭包的or查询会出现问题
Nov 12, 2024
升级后查询范围置后了,会之前没写闭包的or查询出现问题
比如:
User::scope('zuhu')->whereOr([['name','like','%'.$keyword.'%'],['email','like','%'.$keyword.'%'],['mobile','like','%'.$keyword.'%']])->select();
最终的语句是
SELECT * FROM
user
WHERE (name
LIKE '%12345678901%' ORemail
LIKE '%12345678901%' ORmobile
LIKE '%12345678901%' ANDzuhu_id
= '1' ),以前的语句是
SELECT * FROM
user
WHEREzuhu_id
= '1' AND (name
LIKE '%12345678901%' ORemail
LIKE '%12345678901%' ORmobile
LIKE '%12345678901%')为啥要把scope条件置后呢?
The text was updated successfully, but these errors were encountered: