How to Get Data Using Where All in Laravel

Updated 2 weeks ago admin PHP / Laravel

In this lesson, we will see how to get data using Where All in Laravel. The Where All method is used to retrieve data where all the given columns are like a given value.  

How to use Where All in Laravel?

To do that, let's assume that we want to get a user whose first name, last name, and surname are LIKE 'sam'.

User::whereAll(['firstname', 'lastname', 'surname'], 'LIKE', 'sam')->get();