<tutorialjinni.com/>

Laravel IN Query

Posted Under: Laravel, PHP, Programming, Snippets on Feb 26, 2020
Code snippet for "IN" Query in Eloquent and in Query Builder.

Simple SQL query
SELECT  * from  users where id IN (10,20,30,40);
Eloquent Expression
$users = User::whereIn('id', array(10, 20, 30, 40))->get();
Query Builder presentation
$users = DB::table('users')->whereIn('id', array(10, 20, 30, 40))->get();


imgae