Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown column 'distance_sphere' #85

Closed
NickSun opened this issue Mar 5, 2023 · 2 comments
Closed

Unknown column 'distance_sphere' #85

NickSun opened this issue Mar 5, 2023 · 2 comments

Comments

@NickSun
Copy link

NickSun commented Mar 5, 2023

Laravel: 10.1.5
matanyadaev/laravel-eloquent-spatial: 3.1.2

Query example:
Users::whereDistanceSphere('location', $user->location, '<', 20)->get()

Error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'distance_sphere' in 'where clause' (Connection: mysql, SQL: select * from `users` where `distance_sphere` = location)

What do I do wrong?

@MatanYadaev
Copy link
Owner

Hi @NickSun. The code you attached doesn't reproduce the error. There's a chance you are not doing something correctly.
Please fork this repo and add a failing test. It will help me to debug the issue and fix it.

@NickSun
Copy link
Author

NickSun commented Mar 5, 2023

@MatanYadaev you are right. I forgot to add HasSpatial trait to the model. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants