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
Danish -
Ramzi Issiakhem -
MD ARIFUL HAQUE -
TechniveK -
Top comments (0)