title: Laravel grouping where clauses in Eloquent
body: <p>I have created Eloquent query in laravel 5.4 in which I want to filter data through 6 different combination which are as follows:</p>
  
  <ol>
  <li>Category  </li>
  <li>Subcategory </li>
  <li>industry </li>
  <li>style </li>
  <li>orientation</li>
  <li>color</li>
  </ol>
  
  <p><strong>This is the query I have used</strong> </p>
  
  <pre><code> $updatedproducts  = Product::Where('category', $cat)
                       -&gt;Where('subcategory', $subcat)
                       -&gt;whereIn('industry', $industrytags)
                       -&gt;orWhereIn('style', $styletags)
                       -&gt;orWhereIn('orientation', $orientationtags)
                       -&gt;orWhereIn('color', $colortags)
                       -&gt;paginate(12);
  </code></pre>
  
  <p>Its working fine except one thing that category and subcategory is ignored when I fetch results from different category and subcategory I want data where category and subcategory should always match and other 4 remaining filter can be optional.</p>