TIL: Apart from withCount, eloquent also have other aggregate functions like withMax, withMin, withAvg and withSum.
Eg:
$posts = Post::withSum('comments', 'votes')->get();
foreach ($posts as $post) {
echo $post->comments_sum_votes;
}
TIL: Apart from withCount, eloquent also have other aggregate functions like withMax, withMin, withAvg and withSum.
Eg:
$posts = Post::withSum('comments', 'votes')->get();
foreach ($posts as $post) {
echo $post->comments_sum_votes;
}
For further actions, you may consider blocking this person and/or reporting abuse
TuBob -
Hamza Sehouli -
Jorge Santos -
Roberto B. -
Top comments (0)