Posted By

interviewqueries on 09/14/19


Tagged

query in laravel Eloquent


Versions (?)

How to use "IN" Query in Laravel ?


 / Published in: PHP
 

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

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

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

Report this snippet  

You need to login to post a comment.