Is it possible to create multi filter search based on filterBy?

return function($site, $pages, $page) {

  // get all articles and add pagination
  $bookmakers = page('bookmaker')->children()->visible()->paginate(100);
  
  if($query_rating = $_GET['rating']) {
  		$bookmakers = $bookmakers->search($query_rating, 'rating');
	}
  if($query_market = $_GET['market']) {
  		$bookmakers = $bookmakers->search($query_market, 'market');
	}
  
   // create a shortcut for pagination
  $pagination = $bookmakers->pagination();

  // pass $articles and $pagination to the template
  return compact('bookmakers', 'query_market', 'query_rating', 'pagination');

};

and in html name=market with

<select name="market[]" class="selectpicker" data-live-search="true" data-size="5" multiple>
<option value="sportsbook">Sportsbook</option>
<option value="racebook">Racebook</option>
<option value="financial_betting">Financial Betting</option>
<option value="scratch_card">...</option>
</select>

for clean URL I think it will work with $_POST (not tested)

1 Like