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
HasOne Through as an Eloquent relationship #8721
Comments
Maybe I'm misunderstanding - why not use a |
Because that's abusing attributes to work like relations. You can't eager load it, you can't query it and you can't assign it. |
+1 |
1 similar comment
+1 |
+1 I could definitely use this. |
+1 |
+1 |
3 similar comments
+1 |
+1 |
+1 |
Please don't 👍 issues. It doesn't really help anyone. Sending a PR would help, adding a +1 does not. |
Thanks for the report, but we don't process feature requests. We are, however, open to PRs. |
+1 |
1 similar comment
+1 |
I'd like to suggest that we add
hasOneThrough()
as an additional Eloquent relationship. I'll use the example of the hasManyThrough() relationship to explain the use case. You can use thehasManyThrough()
relationship to get the posts of a country. AhasOneThrough()
relationship would allow you to get the country of a post.This effectively allows inverse transversal of the relationship between the chain of models. This relationship exists in Rails, and I've supplied the SQL statement used by ActiveRecord to fetch the country from a post model.
The text was updated successfully, but these errors were encountered: