diff --git a/app/Http/Controllers/MoonsController.php b/app/Http/Controllers/MoonsController.php
index dea16bdf3..1d358f560 100644
--- a/app/Http/Controllers/MoonsController.php
+++ b/app/Http/Controllers/MoonsController.php
@@ -37,42 +37,44 @@ class MoonsController extends Controller
$moons = DB::table('Moons')->orderBy('System', 'asc')->get();
//declare the html variable and set it to null
$html = '';
+ $table = array();
+ $moonprice = null;
foreach($moons as $moon) {
//Setup formats as needed
$spm = $moon->System . ' - ' . $moon->Planet . ' - ' . $moon->Moon;
$rentalEnd = new Carbon($moon->RentalEnd);
$rentalEnd = $rentalEnd->format('m-d');
+
$price = $moonCalc->SpatialMoonsOnlyGoo($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity,
$moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);
$worth = $moonCalc->SpatialMoonsTotalWorth($moon->FirstOre, $moon->FirstQuantity, $moon->SecondOre, $moon->SecondQuantity,
$moon->ThirdOre, $moon->ThirdQuantity, $moon->FourthOre, $moon->FourthQuantity);
+
+ if($type == 'W4RP') {
+ $moonprice = $price['alliance'];
+ } else {
+ $moonprice = $price['outofalliance'];
+ }
//Add the data to the html string to be passed to the view
- $html .= '
';
- $html .= '| ' . $spm . ' | ';
- $html .= '' . $moon->StructureName . ' | ';
- $html .= '' . $moon->FirstOre . ' | ';
- $html .= '' . $moon->FirstQuantity . ' | ';
- $html .= '' . $moon->SecondOre . ' | ';
- $html .= '' . $moon->SecondQuantity . ' | ';
- $html .= '' . $moon->ThirdOre . ' | ';
- $html .= '' . $moon->ThirdQuantity . ' | ';
- $html .= '' . $moon->FourthOre . ' | ';
- $html .= '' . $moon->FourthQuantity . ' | ';
- if($type == 'W4RP') {
- $html .= '' . $price['alliance'] . ' | ';
- } else if ($type == 'Legacy') {
- $html .= '' . $price['outofalliance'] . ' | ';
- } else {
- $html .= 'N/A | ';
- }
- $html .= '' . number_format($worth, "2", ".", ",") . ' | ';
- $html .= '' . $rentalEnd . ' | ';
- $html .= '
';
+ array_push($table, [
+ 'SPM' => $spm,
+ 'StructureName' => $moon->StrucutreName,
+ 'FirstOre' => $moon->FirstOre,
+ 'FirstQuantity' => $moon->FirstQuantity,
+ 'SecondOre' => $moon->SecondOre,
+ 'SecondQuantity' => $moon->SecondQuantity,
+ 'ThirdOre' => $moon->ThirdOre,
+ 'ThirdQuantity' => $moon->ThirdQuantity,
+ 'FourthQuantity' => $moon->FourthQuantity,
+ 'Price' => $moonprice,
+ 'Worth' => number_format($worth, "2", ".", ","),
+ 'RentalEnd' => $rentalEnd,
+ ]);
}
- return view('moons/user/moon')->with('html', $html);
+ return view('moons/user/moon')->with('table', $table);
}
public function displayTotalWorthForm() {
diff --git a/resources/views/moons/user/moon.blade.php b/resources/views/moons/user/moon.blade.php
index adcae53fa..a53e92d71 100644
--- a/resources/views/moons/user/moon.blade.php
+++ b/resources/views/moons/user/moon.blade.php
@@ -18,7 +18,23 @@
Rental End |
- {!! $html !!}
+ @foreach($tables as $row)
+
+ | {{ $row['SPM'] }} |
+ {{ $row['StructureName'] }} |
+ {{ $row['FirstOre'] }} |
+ {{ $row['FirstQuantity'] }} |
+ {{ $row['SecondOre'] }} |
+ {{ $row['SecondQuantity'] }} |
+ {{ $row['ThirdOre'] }} |
+ {{ $row['ThirdQuantity'] }} |
+ {{ $row['FourthOre'] }} |
+ {{ $row['FourthQuantity'] }} |
+ {{ $row['Price'] }} |
+ {{ $row['Worth'] }} |
+ {{ $row['RentalEnd'] }} |
+
+ @endforeach