I am using laravel 5 and having following array:
array:3 [▼
0 => 3,
1 => 4,
2 => 5
]
Now i wanted to get all values/rows from table say 'X' having id's 3,4,5
I am using laravel 5 and having following array:
array:3 [▼
0 => 3,
1 => 4,
2 => 5
]
Now i wanted to get all values/rows from table say 'X' having id's 3,4,5
Try this query
$array = [ 0 => 3,1 => 4, 2 => 5];
$results = DB::table('x')
->whereIn('id',$array)
->get();
You can see the query sample for Laravel 5
$result=DB::table('x')->whereIn('id',[3,4,5])->get();