mercredi 18 janvier 2017

Laravel haversine calculation

I use this tool to calculate distance between 2 points:

$location = new CnpPoi(28.535153, -81.383219);
$destination = new CnpPoi(42.594018, -88.433886)
$location->getDistanceInMilesTo($destination);
$location->getDistanceInMetersTo($destination);

need to use it inside a query to get store ordered by distance from a given point that already have passed trough url his $lat e $long. How i can use this function inside a query?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire