I want to sum two related model values seperatly, then get the difference of the two columns. Shop
has productImages
, product image has original size
and optimized size
. Need to sum original size
, optimized size
seperatly, then get the difference of them, which will be result of size saved
.
$shops = Shop::with(['productImages' => function ($q) {
$q->???;
}])->get();
I need to get the result in one query, how could I achieve this, that I could reach shops size saved
value?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire