ngocnv
644
4
Laravel

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

Posted 1 year ago by ngocnv

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

DATABASE STRUCTURE

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.