Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级后查询范围置后了,如果之前没写闭包的or查询会出现问题 #648

Open
feelec-yishu opened this issue Nov 12, 2024 · 0 comments

Comments

@feelec-yishu
Copy link

feelec-yishu commented 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%' 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条件置后呢?

@feelec-yishu feelec-yishu changed the title 升级后查询范围置后了,会之前没写闭包的or查询出现问题 升级后查询范围置后了,如果之前没写闭包的or查询会出现问题 Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant