Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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();
Comment

PREVIOUS NEXT
Code Example
Php :: php use function from same class 
Php :: string match percentage php 
Php :: set php var to html 
Php :: Enqueue WordPress Scripts and Styles 
Php :: send var in header php 
Php :: yii2 clear schema cache 
Php :: Remove last symbol from string 
Php :: php connect strings 
Php :: drop column table in migration if exist in laravel 
Php :: php define multiple variables as 0 
Php :: symfony no php binaries detected 
Php :: root composer.json requires php ^7.3 but your php version (8.0.3) does not satisfy that requirement. 
Php :: 301 redirect 
Php :: laravel factory 
Php :: wp_cache_get 
Php :: php ++ 
Php :: php check if all array values are the same 
Php :: php array get value at index 
Php :: PHP Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt() 
Php :: model hasmany laravel 
Php :: php check if checkbox isset 
Php :: laravel collection get unique values 
Php :: how to set select option value dynamically in php 
Php :: php catch echo output 
Php :: laravel select raw where 
Php :: slugify text in php 
Php :: route laravel Target class [AuthController] does not exist 
Php :: excerpt with Laravel 
Php :: laravel get route parameters in blade 
Php :: laravel eloquent update 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =