-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
Select fields in included table problem #175
Comments
Yes if you do not include the foreign keys for how two tables are joined, then eloquent can't load that relationship, so I imagine you must include those fields necessary for joining two relations. |
While you do need to include the foreign keys so eloquent can load it properly, this really seems like unnecessary information to have to pass. Seems like query builder should be able to figure this out on it's own and add it when needed. |
The documention says I don't need it:
But it dosen't work as example, need to add the 'author_id' and 'name' to work properly I am newbie in laravel, sorry if I am talking bullshit, but as @ce-brex said, I think query builder should be able to figure out the relations keys without need to declare it in each request. |
Ironically, I have never tested the examples 🙈- I'll update the readme.
I agree. However, we haven't figured out a good solution yet that works for all Eloquent relationships... Feel free to PR any idea that you guys might have. In the meantime I'll leave this issue open |
Dear contributor, because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it. |
I am facing same issue. Could you please suggest any solution for this? |
"spatie/laravel-query-builder": "^3.3" in this version working well But Custom field is not getting in the spatie/laravel-query-builder": "^5.2 |
Add issue #175 link in selecting-fields.md
If I make a request and include a relation table and specific to return just some fields, it return empty.
But if I add the relation id column it returns all fields correct
Is necessary to add the relation id to this work or I am making something wrong?
The text was updated successfully, but these errors were encountered: