How can count table column unique values in Laravel 5.6?

Posted 1 month ago by Flex

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 sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.