I'm attempting to compare a users location (Sent via params in the URL) to offers.offer_lat and offers.offer_long (in my DB) by a distance argument (set in miles)
I'm going crazy right now, a lot of solutions I have found online are proving hard to port over to laravels query builder using DB::raw, I currently have the function in a query scope as the user will be filtering API results using distance, no luck though!
I found some functions online for calculating the haversine but I have no idea how to use them. Here's an example: https://gist.github.com/fhferreira/9081607
Any help would be massively appreciated! :)
Thanks
See Question&Answers more detail:os