evripidesk
6 months ago
28
10
Laravel

Count Values

Posted 6 months ago by evripidesk

Hello I have the below table

id|code   |value
-------------------------
 1|   1      |   true
 2|   1      |   false
 3|   2      |   true
 4|   2      |   true
 5|   1      |   true

I want to show in blade the below (count how many true or false has the code)

Expected output

id|code   |true |false
------------------------------
 1|   1      |  2     | 1
 2|   2      |  2 .   | 0

Can anyone help with the query or the way can to do it?

Please sign in or create an account to participate in this conversation.