-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Using MorphToManyOfDescendants
for graph relationships
#112
Comments
Hi @eli-s-r, Do you need |
@staudenmeir yes, exactly! |
@staudenmeir so would this not be covered by the |
Unfortunately not, Tag -> recursive descendants -> Tag -> morph-to-many -> Your case/direction is a whole new type of relationship. How would you use a |
@staudenmeir we have a bank of educational activities (and other things) that can be tagged by many things (e.g., topic). The structure of the tags is a graph, so breakfast might be a child of food, but also a child of morning activities. If a user searches for food, it's important that anything tagged with food's descendants is also in the results. For the activity -> ancestor tags direction, what I'm doing is to use the results of the
For the tags -> descendants -> activities direction, I'm doing the inverse:
edit: just realized my original goal on the first snippet above was inverted -- I want the ancestors of tags on a model, not the descendants. I updated the first snippet accordingly |
A
|
Hi @staudenmeir, thank you so much for creating this amazing package and for releasing the new graphs feature last week, which perfectly aligns with our use-case. I was wondering if there's a way to get the functionality of the
MorphtoManyOfDescendants
relation that is supported for the tree structure OOTB to work for the graph structure.Below is an oversimplified example of what I'm trying to accomplish (note also the workaround for soft-deleted pivots, there's probably a better way to handle this for the graph structure than what I'm doing?):
Everything above works smoothly. What would be amazing is to be able to define a
descendantTags
relation onHasTags
exactly like is possible for the tree structure:I also tried using your
eloquent-has-many-deep
package, but I don't think it supports the intermediateDescendants
relation (understandably).Do you know of a way to get something like this to work? Thank you so much!
The text was updated successfully, but these errors were encountered: