Question and answer is powered by AnsPress.io
I am using laravel latest version and I want to get the result from the database where(‘id’,’1,2,3’). How can I do that?
In that type of case use whereIn-
$userIds = [1, 2, 3]; $friend = User::whereIn('id', $userIds)->get();
If you use eloquent query then try to do this like:
First create an array
$arr = array(‘1′,’2′,’3’);
then use it into the query
$qry = YourModel::whereIn(‘id’,$arr)->get();