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
Nasrul Hazim Bin Mohamad -
wpbones -
HichemTech -
Hamza Khan -
Top comments (0)