archi_23's avatar

Products filter after searching on laravel

I m working on an e-commerce project. My system can search items. But I want to filter those searched items according to the range of prices. But I can't understand how to do that. Is there anybody who can help me in this regard.?

0 likes
3 replies
automica's avatar

@maliha_archi Are you looking to make the filters in the blade or the eloquent bit that does the filtering in the backend?

Use whereBetween with low and high price:

$products = Product::whereBetween('price',[10,50])->get();
archi_23's avatar

suppose I have already got the searching results but they are not in correct order. I want to arrange them in high to low or low to high order. Should I create a new method or new blade . Actually I want to know how will I make the system understand that I want the 'already searched' products in correct order. I'm a fresher on laravel . Thanks.

Please or to participate in this conversation.