How to Get Data Using Where Any in Laravel
In this lesson, we will see how to get data using Where Any in Laravel, the Where Any method is used to retrieve data where any of the given columns are like a given value.
How to use Where Any in Laravel?
To do that let's assume that we want to get a user whose first name or last name or surname LIKE 'sam'.
User::whereAny(['firstname', 'lastname', 'surname'], 'LIKE', 'sam')->get();