Count with Eloquent
I have a "project" table and I want to count projects by status. Any solution please?
3 Replies
$projectCounts = Project::select('status', DB::raw('COUNT(*) as project_count'))
->groupBy('status')
->get();
@Abdulla Fahem
https://filamentphp.com/docs/3.x/tables/summaries#count
You can also do something like
Project::groupBy('status')->count()
Thanks
Thanks