Skip to content
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

Chaperone Tree Relations #259

Open
tylernathanreed opened this issue Sep 5, 2024 · 0 comments
Open

Chaperone Tree Relations #259

tylernathanreed opened this issue Sep 5, 2024 · 0 comments

Comments

@tylernathanreed
Copy link

tylernathanreed commented Sep 5, 2024

I was recently working on something where I pulled in a tree, and I needed to access information regarding ancestors of the tree. Tapping into these relations caused database queries, despite the models being within the collection already. This resulted in loading 5x the number of models as I had records in the table.

The solution for something like this would be to manually load in the parent/ancestor relations, so that if these relations are called, they load models already in memory, rather than reaching out to the database again.

See #260 for the solution I used to fix this.

In my personal project, I implemented this as a macro. However, I'd like to see this implemented into the package itself.

tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 5, 2024
tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 5, 2024
tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 5, 2024
tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 6, 2024
tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 6, 2024
tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 6, 2024
tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 6, 2024
tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 6, 2024
tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 6, 2024
tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 6, 2024
tylernathanreed added a commit to tylernathanreed/laravel-adjacency-list that referenced this issue Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant