From 1a44be502af12a7586386edc1ecad9d9aefdd041 Mon Sep 17 00:00:00 2001 From: Christopher Mancuso Date: Mon, 5 Jul 2021 22:01:10 -0500 Subject: [PATCH] working on moon rental worth --- .../UpdateAllianceMoonRentalWorth.php | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/app/Jobs/Commands/MoonRental/UpdateAllianceMoonRentalWorth.php b/app/Jobs/Commands/MoonRental/UpdateAllianceMoonRentalWorth.php index 957db5a86..924abd7b8 100644 --- a/app/Jobs/Commands/MoonRental/UpdateAllianceMoonRentalWorth.php +++ b/app/Jobs/Commands/MoonRental/UpdateAllianceMoonRentalWorth.php @@ -52,15 +52,35 @@ class UpdateAllianceMoonRentalWorth implements ShouldQueue 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; + } + //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]); - dd($worth); - $worth = $mHelper->MoonTotalWorth($ores[0], $ores[1], $ores[2], $ores[3], $ores[4], $ores[5], $ores[6], $ores[7]); + $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([