How to use "IN" Query in Laravel ?


/ Published in: PHP
Save to your folder(s)

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();

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.