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


Copy this code and paste it in your HTML
  1. In Laravel you can use "IN" query as
  2.  
  3. Using Eloquent
  4.  
  5. $data = YourModel::whereIn('id', array(1, 2, 3))->get();
  6. Using DB Query builder
  7.  
  8. $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.