33
Eloquent ORMでこれを解決しますか?Laravel 4 Eloquent ORM select where - パラメータとしての配列
私は両親のidetifiersの配列があります。
Array ([0] => 87, [1] => 65, ...)
を、私はテーブルの製品を選択する場所PARENT_ID列=
Eloquent ORMでこれを解決しますか?Laravel 4 Eloquent ORM select where - パラメータとしての配列
私は両親のidetifiersの配列があります。
Array ([0] => 87, [1] => 65, ...)
を、私はテーブルの製品を選択する場所PARENT_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();
または
Product::whereIn('parent_id', array(87, 65, "etc"))->get();
FWIW、また雄弁例では、あなたが '(取得する必要があります)'結果: '製品::ここ( 'PARENT_IDあなたの配列は次のようでなければなりません'、$ parent_ids) - > get(); ' – Ludder