Support the ongoing development of Laravel.io →
Eloquent Laravel Database

I would like to have a list of categories of products with the respective quantity of products associated to them (categories) in laravel 5 like this:

electronics (20) items,

cell phones (100) items

Expected JSON format:

{
"name": "electronic",
"quantity": "20"
},
{
"name": "cell phones",
"quantity": "100"
}

Can someone help me to implement this in laravel 5?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.