Laravel eloquent select count group by code example Example: count column eloquent laravel $total = Post::sum('views');