modified a few moons controller variables to not create the variable each time the loop is run to save on a bit of processing time.

This commit is contained in:
2019-05-21 16:12:41 -05:00
parent f166b72b7d
commit 3826bcd8c8

View File

@@ -41,6 +41,11 @@ class MoonsController extends Controller
$moonCalc->FetchNewPrices(); $moonCalc->FetchNewPrices();
//get all of the moons from the database //get all of the moons from the database
$moons = DB::table('Moons')->orderBy('System', 'asc')->get(); $moons = DB::table('Moons')->orderBy('System', 'asc')->get();
//Set the rental date as last month for moons not rented
$lastMonth = Carbon::now()->subMonth();
//Set a variable for today's date
$today = Carbon::now();
//declare the html variable and set it to null //declare the html variable and set it to null
$table = array(); $table = array();
@@ -55,7 +60,7 @@ class MoonsController extends Controller
if($rental == false) { if($rental == false) {
//If we don't find a rental record, set the rental date as last month //If we don't find a rental record, set the rental date as last month
$rentalTemp = Carbon::now()->subMonth(); $rentalTemp = $lastMonth;
$rentalEnd = $rentalTemp->format('m-d'); $rentalEnd = $rentalTemp->format('m-d');
} else { } else {
//Set the rental date up //Set the rental date up
@@ -63,9 +68,6 @@ class MoonsController extends Controller
$rentalEnd = $rentalTemp->format('m-d'); $rentalEnd = $rentalTemp->format('m-d');
} }
//mark today's date in carbon format
$today = Carbon::now();
$price = $moonCalc->SpatialMoonsOnlyGoo($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity, $price = $moonCalc->SpatialMoonsOnlyGoo($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity,
$moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity); $moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);