douya2982 2019-02-01 17:24
浏览 143

使用多个WhereIn Clause Laravel 4

I need to use multiple WhereIn Clauses with OR in a query.. So I was doing it something like below... It is not working and I am getting an empty result

orWhereIn('cat', $array)
orWhereIn('cat_a', $array)
orWhereIn('child_a', $array)

is it possible? .. I have looked over the internet for solution but could find anything

I am using Laravel 4.2 .. thanks in advance

My Full Query

Note: if I use single whereIn clause.. it works absolutely fine..

$query = Product::query();
$query->orWhereIn('category_id', $ids);
$query->orWhereIn('category_id_2', $ids);
$query->orWhereIn('category_id_3', $ids);
$query->orderBy('price_for_sorting', 'ASC');
$products = $query->paginate(15);
  • 写回答

0条回答 默认 最新

    报告相同问题?