-
Notifications
You must be signed in to change notification settings - Fork 107
Is it possible to include nested relationships? #44
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
Comments
HEY I was coming here to ask the same question! In my case I have a model design for "address" which is used by polymorphic relationship to various other models. An address model has a city model relationship attached to it, which implies a "division" (ex. state) relationship, which implies a country relationship. And then various models have an "address" relationship to their own one-to-one address pairing. In my program, all of the cities in Canada and USA are already in the database (from UN database) and so a false city cannot be entered. But... I'd like to be able to, say "select all buildings in Canada" via the API, as an extreme case example. |
Hi! As per the JSON API spec it is possible to request nested relationships: Using dot notation in the |
Closing this as I don't think there's anything else needed... feel free to open a new issue if needed! |
Is it possible to fetch nested relationship. lets say I am having three resource User, Roles, and Permissions. Permissions have reference of Roles and Roles have reference of Users. I want to Fetch a User along-with its all Permissions referenced against all of its Roles.
What I was trying to pass a query parameter http://myapi.com/v1/users?include=roles.permissions because in laravel nested relationships are fetched like this. This is giving me error of not allowed include.
I was looking if there is any work around, Otherwise what I have to do is:
ps: I have considered users, roles, permissions example to make it simple. I am implementing this thing against some complex data models which do have hundreds of relationship records.
Thanks
Furqan Aziz
The text was updated successfully, but these errors were encountered: