-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Add isParentOf, isChildOf, depthRelatedTo #232
Add isParentOf, isChildOf, depthRelatedTo #232
Conversation
Hi @PaperTurtle, |
Thanks @staudenmeir, |
|
||
public function isParentOf(Model $model) | ||
{ | ||
if (!$this->relationLoaded('children')) { |
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.
The if {}
here (and in the other methods) is not necessary. $this->children
automatically loads the relationship if necessary.
@staudenmeir Thanks for the feedback, I've implemented your suggestions. |
Thanks! I've renamed the third method to |
I've released a new version. |
This merge request add three new methods mentioned in (#179) to the HasRecursiveRelationships Trait.
I've tried to create a test for the depthRelatedTo, but I cannot get it to work.
However, I have created a Laravel Project to test if the methods work accordingly. I've created an example Model:
and then tried the methods out:
Everything seems to work correctly. Feedback is welcome.
Thanks in advance.