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

[5.5] Allow where and dynamicWhere to handle arrays #20470

Closed

Conversation

BrandonShar
Copy link
Contributor

Currently if you pass an array as the value of where, you get strange behavior:

User::whereName(['brandon', 'matt'])->get();
select * from `users` where `name` = 'brandon'

or much worse

User::whereName(['brandon', 'matt'])->whereId(5)->get();
select * from `users` where `name` = 'brandon' and `id` = 'matt'

This PR would assume the user was interested in a whereIn query instead and handle that automatically.

User::whereName(['brandon', 'matt'])->get();
select * from `users` where `name` in ('brandon', 'matt')
// OR
User::where('name', '<>', ['brandon', 'matt'])->get();
select * from `users` where `name` not in ('brandon', 'matt')

@fitztrev
Copy link
Contributor

fitztrev commented Aug 8, 2017

Related #19126

@taylorotwell
Copy link
Member

Holding off for now.

@BrandonShar
Copy link
Contributor Author

Thanks for taking a look.

Don't know how I missed that PR when I searched around. Thanks for the link @fitztrev

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

Successfully merging this pull request may close these issues.

3 participants