Tell me, please, what kind of query can be used to get all records related to recursion? #247
-
I have a product and category model. The relationship between them is many-to-many.
It seems to me that I can do this with one simpler query.
I'm using Laravel 8 and laravel-adjacency-list:"^1.9.6". |
Beta Was this translation helpful? Give feedback.
Answered by
ilyapokrov
Jul 11, 2024
Replies: 1 comment 7 replies
-
Please log the executed SQL and share the |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@staudenmeir
I think I've figured it out. The following method works for me:
$allProducts = Category::find($category->category_id)->recursiveRoles()->get();
Instead of "$category->id" I indicated "$category->category_id".
Because I changed getLocalKeyName =)))