0

I want to, given a set of ids - ex:

array(500) {
  [0]=>
  string(7) "5700266"
  [1]=>
  string(9) "514803345"
  [2]=>
  string(9) "527286881"
  [3]=>
  string(9) "533641181"
  [4]=>
  string(9) "533793077"
  ...
}

execute a query that checks which ids exists on db.

I've tried to use eager load but couldn't make it work.

Basically I need to retrieve all users in that array set. (I'm trying to avoid doing it user by user).

Thanks!

1 Answer 1

1

You probably will be able to do it by

$users = User::whereIn('id', $yourArrayOfIds)->get();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.