Support the ongoing development of Laravel.io →
Eloquent Laravel
Last updated 1 year ago.
0

Hi Daniel,

As far as I can tell there is also a products table. Please refer to the documentation.

$products = Product::withCount('solderings')->get();
foreach($products as $product)
    echo $product->solderings_count;

I can recommend you to have the Product model as well, otherwise you need to group by product_id.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Daniel Andrade dansku Joined 24 Nov 2017

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.

© 2024 Laravel.io - All rights reserved.