2013-07-12 5 views

答えて

68

流暢アレイ内の任意のid:

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

雄弁:

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

FWIW、また雄弁例では、あなたが '(取得する必要があります)'結果: '製品::ここ( 'PARENT_IDあなたの配列は次のようでなければなりません'、$ parent_ids) - > get(); ' – Ludder

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

または

Product::whereIn('parent_id', array(87, 65, "etc"))->get(); 
関連する問題