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

Search by nested relationships #254

Open
KarlaRomero17 opened this issue May 15, 2024 · 1 comment
Open

Search by nested relationships #254

KarlaRomero17 opened this issue May 15, 2024 · 1 comment
Labels
question Further information is requested

Comments

@KarlaRomero17
Copy link

KarlaRomero17 commented May 15, 2024

Hello, i'm new with orion and i encountered an issue on my code.
These are the tables:

  • Location
    --City
    ---Country

i want to search by the name of the country and i got this error:
"message": "Call to undefined method location.city.country()",

The functions are:

protected function alwaysIncludes() : array
{
    return ['location.city.country'];
}

protected function searchableBy() : array
{
    return ['location.city.country.name'];
} 

I checked the relationships on models and it looks apparently formed correctly.

if you any idea, please let me know. Thanks

@v-radev
Copy link

v-radev commented May 16, 2024

Hey @KarlaRomero17, is this your location controller? Because in that case you should have just ['city.country']. Also have you tried loading just location or location.city to see if that works?

@alexzarbn alexzarbn added the question Further information is requested label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants