added routes for new views

added displayTotalWorth view display
added form response for displaying total worth
modified Moons Controller
modified Moon Calc class
This commit is contained in:
2018-11-07 16:47:26 -06:00
parent a201986ef7
commit 62af0bcd5d
5 changed files with 339 additions and 2 deletions

View File

@@ -74,7 +74,6 @@ class MoonsController extends Controller
'region' => 'required',
'system' => 'required',
'structure' => 'required',
]);
// Add new moon
@@ -127,4 +126,36 @@ class MoonsController extends Controller
return redirect('/moons/display')->with('success', 'Moon Updated');
}
public function displayTotalWorthForm() {
return view('moons.formTotalWorth');
}
public function displayTotalWorth(Request $request) {
$firstOre = $request->firstOre;
$firstQuantity = $request->firstQuantity;
$secondOre = $request->secondOre;
$secondQuantity = $request->secondQuantity;
$thirdOre = $request->thirdOre;
$thirdQuantity = $request->thirdQuantity;
$fourthOre = $request->fourthOre;
$fourthQuantity = $request->fourthQuantity;
//Setup calls to the MoonCalc class
$moonCalc = new MoonCalc();
//Update the prices for the moon
$moonCalc->FetchNewPrices();
$totalGoo = $moonCalc->SpatialMoonsOnlyGooTotalWorth($firstOre, $firstQuantity,
$secondOre, $secondQuantity,
$thirdOre, $thirdQuantity,
$fourthOre, $fourthQuantity);
$totalWorth = $moonCalc->SpatialMoonsTotalWorth($firstOre, $firstQuantity,
$secondOre, $secondQuantity,
$thirdOre, $thirdQuantity,
$fourthOre, $fourthQuantity);
return view('moons.displayTotalWorth')->with(['totalWorth' => $totalWorth, 'totalGoo' => $totalGoo]);
}
}