Level 4
$users = collect(
DB::table('users')
->whereIn('id', $userIds)
->get()
);
Hi, I have a collection containg an array of user Ids
Collection {#214 ▼
#items: array:4 [▼
0 => 4
1 => 1
2 => 2
3 => 3
]
}
How would you use that to retrieve the corresponding users in a separate collection?
$users = collect(
DB::table('users')
->whereIn('id', $userIds)
->get()
);
Please or to participate in this conversation.