mercredi 3 octobre 2018

How to Searching between min and max prices in Laravel

I know in mysql query it is something like this

SELECT id 
FROM listings 
WHERE id  IN (
  SELECT id
  FROM listings
  WHERE price between 200 and 500
);

in laravel query I tired

Listing::select('listings.*')
                 ->whereBetween('price', [200, 500])
                 ->groupBy('listings.id')
                 ->orderBy('listings.id', 'desc')
                 ->paginate(1000);

did I wrong somewhere ? It just show only 1 result ?

thank you for your helps!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire