Level 24
Job::select('status', DB::raw('count(*) count'))->groupBy('status')->get();
1 like
if I have a table containing a job and a job can have a status of one of three values. What is the Laravel/Eloquent way of getting a count of each status?
I can do with separate count queries but not sure how to group-by and count with Eloquent.
Job::select('status', DB::raw('count(*) count'))->groupBy('status')->get();
Please or to participate in this conversation.