📌  相关文章
📜  在 laravel 中从经度和纬度获取附近 - PHP代码示例

📅  最后修改于: 2022-03-11 14:53:48.325000             🧑  作者: Mango

代码示例1
\DB::table("users")
     ->select("users.id", \DB::raw("6371 * acos(cos(radians(" . $this->lat . "))
     * cos(radians(users.latitude)) 
     * cos(radians(users.longitude) - radians(" . $this->lng . ")) 
     + sin(radians(" .$this->lat. ")) 
     * sin(radians(users.latitude))) AS distance"))
     ->having('distance', '<', $this->rad)
     ->first();