-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
[5.8] Add Eloquent HasOneThrough relationship #26057
Conversation
This commit adds the Eloquent HasOneThrough relationship. This will allow for easy linking to deeper nested models and easy eager loading of them. Many thanks to @frdteknikelektro and his original PR which really was most of the work: #25083
* | ||
* @return void | ||
*/ | ||
public function tearDown() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not necessary: The in-memory database "destroys" itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to stick to this for now since the other tests have it as well. I see what you're saying but it's best to stick to the convention of having them if all the other tests do as well.
Should we create a |
This rename now covers both use cases for one or many through relationships. If people were using this key, this might break some things but imo they shouldn't rely on it.
@staudenmeir not sure if it has that much benefit here tbh. |
This could already be added to L5.7 right? |
@freekmurze all other prs for this were requested to be sent to master so sending this to master as well. Since this PR renames the through key, I think it's the best thing to do. |
@driesvints Thanks for the credit, i'm glad that it has been merged! awesome! |
Can an example case be provided to understand when the right time to use it would be? |
@JeffreyDavidson docs have already been updated: https://laravel.com/docs/master/eloquent-relationships#has-one-through |
This commit adds the Eloquent HasOneThrough relationship. This will allow for easy linking to deeper nested models and easy eager loading of them.
Many thanks to @frdteknikelektro and his original PR which really was most of the work: #25083