1$items = DB::table('team')
2 ->selectRaw('SELECT *,earth_distance(ll_to_earth(team.lat, team.lng), ll_to_earth(23.1215939329,113.3096030895)) AS distance')
3 ->whereRaw('earth_box(ll_to_earth(23.1215939329,113.3096030895),1000) @> ll_to_earth(team.lat, team.lng)')
4 ->paginate(10);
5
6foreach($items as $item) {
7 echo $item->distance;
8}