I have read all related questions to this issue but could not found solution.
I have saved coordinates in mysql colum type point, in laravel model i have saved like this
use Spatial;
protected $spatial = ['location'];
To get coordinates, i can do like this
$model->getCoordinates();
But i want to select all those records with is 10km distance, how i can create laravel eloquent query for that?
Note: there is no lat,lon columns separately in my table so this query wont work
$results = DB::select(DB::raw('SELECT id, ( 3959 * acos( cos( radians(' . $lat . ') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(' . $lng . ') ) + sin( radians(' . $lat .') ) * sin( radians(lat) ) ) ) AS distance FROM articles HAVING distance < ' . $distance . ' ORDER BY distance') );
Updated: I have used laravel Voyager to save map locations, here is link