Is there a way to filter user within a distance using eloquent?

Posted 11 months ago by ngocnv

I have two tables users and current_locations (it saves user location).


USERS id email username gender country_code

CURRENT_LOCATIONS id user_id longitude latitude

Now I want to get nearby user with my current user lat long. And I can filter by username, gender, country_code also. If you guys know any articles looks similar pls send me.

Many thanks!

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.