$moon->moon_id, ])->get(['ore_name', 'quantity'])->toArray(); if(sizeof($ores) == 1) { $ores[1]["ore_name"] = null; $ores[1]["quantity"] = 0.00; $ores[2]["ore_name"] = null; $ores[2]["quantity"] = 0.00; $ores[3]["ore_name"] = null; $ores[3]["quantity"] = 0.00; } else if(sizeof($ores) == 2) { $ores[2]["ore_name"] = null; $ores[2]["quantity"] = 0.00; $ores[3]["ore_name"] = null; $ores[3]["quantity"] = 0.00; } else if(sizeof($ores) == 3) { $ores[3]["ore_name"] = null; $ores[3]["quantity"] = 0.00; } //one of these two ways will work $worth = $mHelper->MoonTotalWorth($ores[0]["ore_name"], $ores[0]["quantity"], $ores[1]["ore_name"], $ores[1]["quantity"], $ores[2]["ore_name"], $ores[2]["quantity"], $ores[3]["ore_name"], $ores[3]["quantity"]); $rentalAmount = $worth * $rentalTax * $months; AllianceMoon::where([ 'moon_id' => $moon->moon_id, ])->update([ 'worth_amount' => $worth, 'rental_amount' => $rentalAmount, ]); } */ return 0; } }