2013-07-12 14 views

risposta

68

Fluent:

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

eloquente:

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

FWIW, anche nel esempio eloquente è necessario 'get()' i risultati: prodotto :: in cui ('parent_id ' ', $ parent_ids) -> get(); ' – Ludder

20

Il tuo array deve essere come questo:

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

o

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