Laravel 4雄辩的ORM选择where-数组作为参数

Laravel 4雄辩的ORM选择where-数组作为参数,laravel,laravel-4,eloquent,Laravel,Laravel 4,Eloquent,这个问题的解决方案是雄辩的ORM吗 我有一个包含父标识符的数组: Array ( [0] => 87, [1] => 65, ... ) 我想要选择表产品,其中父id列=数组中的任意id DB::table('PRODUCTS')->whereIn('parent_id', $parent_ids)->get(); 雄辩的: Product::whereIn('parent_id', $parent_ids)->get(); 您的阵列必须如下所示: $arr

这个问题的解决方案是雄辩的ORM吗

我有一个包含父标识符的数组:

Array ( [0] => 87,  [1] => 65, ... )
我想要选择表产品,其中父id列=数组中的任意id

DB::table('PRODUCTS')->whereIn('parent_id', $parent_ids)->get();
雄辩的:

Product::whereIn('parent_id', $parent_ids)->get();

您的阵列必须如下所示:

$array = array(87, 65, "etc");
Product::whereIn('parent_id', $array)->get();


FWIW,同样在这个雄辩的例子中,您需要
get()
结果:
Product::where('parent_id',$parent_id)->get()
Product::whereIn('parent_id', array(87, 65, "etc"))->get();