1\DB::table("users")
2 ->select("users.id", \DB::raw("6371 * acos(cos(radians(" . $this->lat . "))
3 * cos(radians(users.latitude))
4 * cos(radians(users.longitude) - radians(" . $this->lng . "))
5 + sin(radians(" .$this->lat. "))
6 * sin(radians(users.latitude))) AS distance"))
7 ->having('distance', '<', $this->rad)
8 ->first();
9