in my app I want to show nearest places from map center coordinate, after looking for solutions I found a raw SQL query I could use in my laravel app:
This is my method:
$venues = Venue::select(DB::raw('*, ( 6367 * acos( cos( radians('.$latitude.') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('.$longitude.') ) + sin( radians('.$latitude.') ) * sin( radians( lat ) ) ) ) AS distance')) ->having('distance', '<', 25) ->orderBy('distance') ->get();
It is working perfectly but right here:
->having('distance', '<', 25)
I don't know what kind of measurement the 25 is, is it kilometers, miles, obviously it's not meters, anybody can help me?