From 3826bcd8c840d4edb115ffb64a4225f5556664d4 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Tue, 21 May 2019 16:12:41 -0500 Subject: [PATCH] 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. --- app/Http/Controllers/Moons/MoonsController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Moons/MoonsController.php b/app/Http/Controllers/Moons/MoonsController.php index d31a2d044..364b8f7f2 100644 --- a/app/Http/Controllers/Moons/MoonsController.php +++ b/app/Http/Controllers/Moons/MoonsController.php @@ -41,6 +41,11 @@ class MoonsController extends Controller $moonCalc->FetchNewPrices(); //get all of the moons from the database $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 $table = array(); @@ -55,7 +60,7 @@ class MoonsController extends Controller if($rental == false) { //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'); } else { //Set the rental date up @@ -63,9 +68,6 @@ class MoonsController extends Controller $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, $moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);