Level 3
Project::select('type')->get()->groupBy('type')
->map(function($projectsType){
return $projectsType->count();
}
);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
working with laravel 5.6 and mysql. I have following table name as projects
id name type
1 tuna bio
2 nhye IT
3 hyuj bio
4 tour IT
5 ghyt commerce
I need count type column values which are unique values. as an example in above table I need count values 3 because there are three different values like bio, IT and commerce. how can I do this?
Please or to participate in this conversation.