Return to Snippet

Revision: 77349
at September 14, 2019 16:27 by interviewqueries


Initial Code
In Laravel you can use "IN" query as

Using Eloquent

$data = YourModel::whereIn('id', array(1, 2, 3))->get();
Using DB Query builder

$data = DB::table('your_table')->whereIn('id', array(1, 2, 3))->get();

Initial URL
http://www.laravelinterviewquestions.com/trick/in-query-in-laravel-eloquent-mje/

Initial Description
In Laravel you can use "IN" query as

Using Eloquent

$data = YourModel::whereIn('id', array(1, 2, 3))->get();
Using DB Query builder

$data = DB::table('your_table')->whereIn('id', array(1, 2, 3))->get();

Initial Title
How to use "IN" Query in Laravel ?

Initial Tags
query

Initial Language
PHP