title: laravel advanced wheres not working
body: <p>my function with advanced wheres is not giving any syntax error but its not even working. Its displaying. i have written this function following this example <a href="http://laravel.com/docs/queries#advanced-wheres" rel="nofollow">http://laravel.com/docs/queries#advanced-wheres</a></p>
  
  <pre><code>public function getData($wheres1 = array(),$wheres2 = array(),$wheres3 = array(),$wheres4 = array(),$wheres5 = array(),$wheres6 = array(),$wheres7 = array())
      {
      $query = Listing::query();
      $result = array();
  
        $query = $query-&gt;where(function($q){
  
        if(!empty($wheres1)){
  
          $count=0;
         foreach($wheres1 as $where){ 
         if($count==0)
         { $q = $q-&gt;where($where['field'], $where['operator'], $where['value']);
                 $count++;
         }
         else
           $q = $q-&gt;orWhere($where['field'], $where['operator'], $where['value']);
  
         }
       }
  
        })-&gt;where(function($q){
  
              if(!empty($wheres2)){
  
          $count=0;
         foreach($wheres2 as $where){ 
         if($count==0)
         { $q = $q-&gt;where($where['field'], $where['operator'], $where['value']);
                 $count++;
         }
         else
           $q = $q-&gt;orWhere($where['field'], $where['operator'], $where['value']);
  
         }
       }
  
  
  
        })-&gt;where(function($q){
  
          if(!empty($wheres3)){
  
          $count=0;
         foreach($wheres3 as $where){ 
         if($count==0)
         { $q = $q-&gt;where($where['field'], $where['operator'], $where['value']);
                 $count++;
         }
         else
           $q = $q-&gt;orWhere($where['field'], $where['operator'], $where['value']);
  
         }
       }
  
  
        });
  
  
      $result = $query-&gt;orderBy('id', 'desc')-&gt;paginate(3);
      return $result;
  
      }    
  </code></pre>