Rifat's avatar
Level 1

Fetch products from price range

I am developing a e-commerce website with laravel. I have a price range slider. It gives me min and max values. How can I fetch all the products form the products table between that min and max price?

0 likes
1 reply
bobbybouwmann's avatar

You can do this

$min = request()->input('min');
$max = request()->input('max');

$products = Product::whereBetween('price', [$mix, $max])->get();
1 like

Please or to participate in this conversation.