diff --git a/app/Console/Commands/MoonRental/ExecuteUpdateAllianceMoonRentalWorth.php b/app/Console/Commands/MoonRental/ExecuteUpdateAllianceMoonRentalWorth.php index 74e86b8c5..1e7f85aad 100644 --- a/app/Console/Commands/MoonRental/ExecuteUpdateAllianceMoonRentalWorth.php +++ b/app/Console/Commands/MoonRental/ExecuteUpdateAllianceMoonRentalWorth.php @@ -64,17 +64,37 @@ class ExecuteUpdateAllianceMoonRentalWorth extends Command foreach($moons as $moon) { //Declare the arrays needed $ores = array(); + $worth = 0.00; $ores = AllianceMoonOre::where([ 'moon_id' => $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; + } + dd($ores); //one of these two ways will work - $worth = $mHelper->MoonTotalWorth($ores[0][0], $ores[0][1], $ores[1][0], $ores[1][1], $ores[2][0], $ores[2][1], $ores[3][0], $ores[3][1]); + $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"]); dd($worth); - $worth = $mHelper->MoonTotalWorth($ores[0], $ores[1], $ores[2], $ores[3], $ores[4], $ores[5], $ores[6], $ores[7]); $rentalAmount = $worth * $rentalTax * $months; AllianceMoon::where([