Update HomeController.php

This commit is contained in:
Mian Zaid Bin Khalid 2022-06-08 16:19:48 +09:00 committed by GitHub
parent 6b65d4122e
commit 3dcb3918b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -26,7 +26,7 @@ class HomeController extends Controller
$product_costs = 0;
foreach (Sale::completed()->with('saleDetails')->get() as $sale) {
foreach ($sale->saleDetails as $saleDetail) {
foreach ($sale->saleDetails??[] as $saleDetail) {
$product_costs += $saleDetail->product->product_cost;
}
}