I use laravel 4.2, I'have a table called pois who contain some poi (poi = point of interest), i'have a second table called stamps who contain user stamps.
So i want to have the 3 pois where user have the maximum amount of stamp. My problem is i dont know how to this using laravel queries. I got my result using sql request, but it'snt the good way to do this. here my sql request :
$pois = DB::select("SELECT *, (SELECT count(*) from stamps WHERE pois.id = stamps.poi_id) nbr_stamps FROM pois order by nbr_stamps DESC limit 3"); can you tell me how to do this with laravel queries ?