Vigyata.AI
Is this your channel?

New whereAny & whereAll Methods Added - New in Laravel 10.47.0

805 views· 57 likes· 2:09· Mar 7, 2024

🛍️ Products Mentioned (3)

=== Offer === GET 30% DISCOUNT ON ALL PLANS OF CLOUDWAYS HOSTING FOR 3 MONTHS https://unified.cloudways.com/signup?id=1029148&coupon=CW30FOR3 === Important Links === Fonts, extensions I use, and Support Laratips links: https://bit.ly/m/laratips === Video Related Links === === Other Videos === What's New In Laravel 9 https://youtu.be/qAzrZUG_9Z0 New In Laravel Playlist https://www.youtube.com/playlist?list=PL2DahmvUpeuu4UVWrcxlvVkMiI0SeS2OZ Laravel Package Development Playlist https://www.youtube.com/playlist?list=PL2DahmvUpeuu8HkpbNT-cKernolVdqZq_ Password Validation In Laravel with at least one Letters, Numbers, Upper and Lowercase or Symbols: https://youtu.be/f-g3P9imPZs Multiple Apis With ForwardsCalls Trait And Code Refactoring Tip - Laravel Hidden Feature: https://youtu.be/vzgNm86ezWE Laravel Chunking - You Might Be Doing This Wrong - Problem and Solution: https://youtu.be/aQCHmB4Uh0Q Laravel Tip - Properly Get Data Between Two Dates https://youtu.be/bJkEBTg1NGA Get Data From Multiple Databases In One Project | Laravel Tip https://youtu.be/KJAXLf78QPs === Attribution === Boy waving hand Video by VideoPlasty .com (https://pixabay.com/users/videoplasty-19751245/?utm_source=link-attribution&utm_medium=referral&utm_campaign=video&utm_content=80696) from Pixabay #laravel #php #laraveltip #laratips

About This Video

Hey everyone, in this video I’m showing a small but really nice feature that landed in Laravel 10.47.0: the new whereAny and whereAll query builder methods. I start by running a simple “get users” query so you can see what’s happening in the SQL, and then I move into a very common scenario—searching users by a text like “Laratips” across multiple columns like name, email, and the about section. Before this release, if you wanted to match “any of these columns contains this text”, you typically had to write a nested where with multiple orWhere calls—basically repeating yourself three times. Now with whereAny, I can pass an array of columns (name, email, about) and apply the same operator/value once, and Laravel generates the same SQL with the OR conditions for me. On the other side, whereAll is for when you want all columns to match—Laravel will generate AND conditions instead of OR. So if you need users where the type is normal and they must have “Laratips” in both name and about, whereAll makes that super clean. It’s a simple change, but it keeps your queries readable and your code much cleaner.

Frequently Asked Questions

🎬 More from Laratips