Fixed #11
This commit is contained in:
parent
4f483a9bf2
commit
a728ea0dc6
|
@ -25,7 +25,9 @@ class HomeController extends Controller
|
|||
|
||||
foreach (Sale::completed()->with('saleDetails')->get() as $sale) {
|
||||
foreach ($sale->saleDetails??[] as $saleDetail) {
|
||||
$product_costs += $saleDetail->product->product_cost * $saleDetail->quantity;
|
||||
if (!is_null($saleDetail->product())) {
|
||||
$product_costs += $saleDetail->product->product_cost * $saleDetail->quantity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue