Reputation: 3079
Is solution for this in Eloquent ORM?
I have array with parents idetifiers:
Array ( [0] => 87, [1] => 65, ... )
And i want select table PRODUCTS where parent_id column = any id in array
Upvotes: 38
Views: 55921
Reputation: 511
Your array must be like this :
$array = array(87, 65, "etc");
Product::whereIn('parent_id', $array)->get();
or
Product::whereIn('parent_id', array(87, 65, "etc"))->get();
Upvotes: 24
Reputation: 12470
Fluent:
DB::table('PRODUCTS')->whereIn('parent_id', $parent_ids)->get();
Eloquent:
Product::whereIn('parent_id', $parent_ids)->get();
Upvotes: 80