public function fetchProducts($filters = array()) {
print_r($filters);
$Product = new Product;
if (array_key_exists('search', $filters))
$Product->where('name', 'LIKE', '%'.$filters['search'].'%');
if (array_key_exists('type', $filters))
$Product->where('type_id', 1);
if (array_key_exists('brand', $filters))
$Product->where('brand_id', $filters['brand']);
$Product->get();
return $Product;
}
但無論來自哪個過濾器,它返回的所有產品,似乎不顧一切。
我在做什麼錯?
你用雄辯的ORM? – Ronser 2014-11-22 10:31:28
@羅塞爾是的,我是。 – imperium2335 2014-11-22 10:31:57