Here is how you do in Eloquent
$users = User::whereIn('id', array(1, 2, 3))->get();
And if you are using Query builder then :
$users = DB::table('users')->whereIn('id', array(1, 2, 3))->get();
More Related Contents:
- Get Specific Columns Using “With()” Function in Laravel Eloquent
- Add a custom attribute to a Laravel / Eloquent model on load?
- Get the Query Executed in Laravel 3/4
- Laravel Eloquent sort by relation table column
- Laravel Many to many self referencing table only works one way
- Property Property Property [title] does not exist on this collection instance does not exist on this collection instance does not exist on this collection instance
- Automatically deleting related rows in Laravel (Eloquent ORM)
- How to do this in Laravel, subquery where in
- Laravel Eloquent Query Using WHERE with OR AND OR?
- Laravel Check If Related Model Exists
- Laravel update model with unique validation rule for attribute
- How can I convert many statement mysql to laravel eloquent?
- Eloquent ORM Code Hinting in PhpStorm
- Laravel Model with Two Primary Keys update [duplicate]
- Laravel eager loading with limit
- What does “Mass Assignment” mean in Laravel?
- Laravel OrderBy relationship count
- Laravel Checking If a Record Exists
- How to set a default attribute value for a Laravel / Eloquent model?
- Laravel 5 hasMany relationship on two columns
- Order By before Group By using Eloquent (Laravel)
- Laravel Recursive Relationships
- How to Merge Two Eloquent Collections?
- How to create a subquery using Laravel Eloquent?
- Eloquent model mass update
- Difference between Eloquent\Model::get() and all()
- Laravel 4.1: How to paginate eloquent eager relationship?
- Eloquent many-to-many-to-many – how to load distant relation easily
- Eloquent groupBy make “SQLSTATE[42000]” with valid SQL query in Laravel 5.3
- Laravel Eloquent update just if changes have been made