mardi 22 mars 2016

Order results by latitude longitude and distance in Laravel Eloquent

I have a Model that has latitudes and longitudes stored and I want it to orderBy distance from a given coordinate.

But how can I do that? I can find enough information about how to search in a given distance and latlng, but not how to order them.

I want to order them by distance from my own given coordinate asc.

Foobar::orderBy('distance', 'asc')->get()



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire