title: Laravel - AJAX Search allow Multiple Filters to be applied
body: <p>I have a controller that works on an AJAX jQuery call when I need to search/filter the database:</p>
  
  <pre><code>$launchsitesatellite = DB::table('satellites')
  -&gt;where(function($q) use ($request) {
      if(empty($request-&gt;type) &amp;&amp; empty($request-&gt;rocket_type)) {
          $q-&gt;orWhere('satname','LIKE','%'.$request-&gt;search.'%')
              -&gt;orWhere('norad_cat_id','LIKE','%'.$request-&gt;search.'%')
              -&gt;orWhere('country','LIKE','%'.$request-&gt;search.'%')
              -&gt;orWhere('object_id','LIKE','%'.$request-&gt;search.'%');
      } else {
          if(!empty($request-&gt;type)) {
              $q-&gt;orWhere($request-&gt;type,'LIKE','%'.$request-&gt;search.'%');
          }
          if(!empty($request-&gt;object_type)) {
              $q-&gt;orWhere('object_type','LIKE','%'.$request-&gt;object_type.'%');
          }
          if(!empty($request-&gt;launch_year)) {
              $q-&gt;orWhere('launch','LIKE','%'.$request-&gt;launch_year.'%');
          }
      }
  })
  -&gt;where('site', $site_code)-&gt;Paginate(300);
  </code></pre>
  
  <p>This controller can search/filter my database with no problem. The only thing I would like to fix is to allow multiple filters to be applied. For example, currently when I filter by Object Type and then decide to filter by Country, it resets the Object Type. </p>
  
  <p>What I want to be able to do is to allow it to filter by Object Type AND Country, not only one.</p>
  
  <p>There was a lack of examples/documentation so I could not find any examples of how this is done.</p>
  
  <p>EDIT: JS AJAX Call</p>
  
  <pre><code>$("#filter-type").change(function() {
  $value=$(this).val();
    $.ajax({
      type: "get",
      url: "{{$launchsitename-&gt;site_code}}",
      data: {'search':$value, type:'object_type'},
      success: function(data){
        $('#launchsatdisplay').html(data);
      }
  });
  });
  </code></pre>