I want to get all product where name = $query and Minrate between 0-49 et 50-99
I test this but not working
$brans = request()->priceFilter;
if(!empty($brans)):
$product = "";
foreach($brans as $data){
$minMax = explode("-",$data);
if(count($minMax)==2){
$product[] = Afica::search()
->multiMatch(['name','city_hotel'], $query, ['fuzziness' => 'AUTO'])
->must()
->filter()
->range('minrate',['gte'=>0,'lte'=>49])
->sortBy('minrate','asc')->paginate(25);
}
}
$books = $product[0];
for($i=1;$i<count($product);$i++){
$books= $product[$i]
->paginate(25);
}
if ($request->ajax())
{
return view('presult', compact('books'));
}
return view("welcome")->with('books',$books);
else:
$books = Afica::search()
->paginate(26);
return view("welcome")->with('books',$books);
endif; How to view products whose price is between 0 -49 and also between 50-99
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire