Answers for "get nearby from longitude and latitude in laravel"

PHP
0

get nearby from longitude and latitude in laravel

\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();
Posted by: Guest on December-15-2020

Code answers related to "get nearby from longitude and latitude in laravel"

Browse Popular Code Answers by Language