Eager loading aggregate functions of nested relations #38049
Unanswered
l-alexandrov
asked this question in
Ideas
Replies: 3 comments 5 replies
-
I also want! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Maybe this Author::withMin('rating')->with(['posts'=>function($query){
$query->withMin('comments')->groupBy('author_id');
}])->get() |
Beta Was this translation helpful? Give feedback.
5 replies
-
@erikn69 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to eager load some aggregate function like
withMin
of a nested relation, but it is not possible.Let's imagine we have the following models:
I want to execute the following query:
Author::withMin('posts.comments', 'rating')->get()
.Beta Was this translation helpful? Give feedback.
All reactions