alliance moons spreadsheet conversion to services

This commit is contained in:
2020-01-31 00:07:31 -06:00
parent 2e396f4ec7
commit a52d0453bb
11 changed files with 161 additions and 13 deletions

View File

@@ -28,16 +28,58 @@ class MoonsController extends Controller
}
/**
* Function to display the moons and pass data to the blade template
* Function to display all alliance moons and pass data to the blade template
*/
public function displayMoons() {
$moons = array();
//Get all of the alliance moons from the database
$moonsTemp = DB::table('AllianceMoons')->orderBy('System', 'asc')->get();
//Get the unique systems from the database
$systems = AllianceMoons::pluck('System')->toArray();
foreach($systems as $system) {
foreach($moonsTemp as $moon) {
if($moonsTemp->System == $system) {
array_push($moons[$system], [
'Region' => $moon->Region,
'System' => $moon->System,
'Planet' => $moon->Planet,
'System' => $moon->System,
'FirstOre' => $moon->FirstOre,
'FirstQuantity' => $moon->FirstQuantity,
'SecondOre' => $moon->SecondOre,
'SecondQuantity' => $moon->SecondQuantity,
'ThirdOre' => $moon->ThirdOre,
'ThirdQuantity' => $moon->ThirdQuantity,
'FourthOre' => $moon->FourthOre,
'FourthQuantity' => $moon->FourthQuantity,
'Corporation' => $moon->Corporation,
'Available' => $moon->Available,
]);
}
}
}
dd($moons);
return view('moons.user.allmoons')->with('moons', $moons)
->with('systems', $systems);
}
/**
* Function to display the moons and pass data to the blade template
*/
public function displayRentalMoons() {
$rentalEnd = '';
//Get the user type from the user Auth class
$type = Auth::user()->user_type;
$type = Auth::user()->getUserType();
//Setup calls to the MoonCalc class
$moonCalc = new MoonCalc();
//get all of the moons from the database
//get all of the rental 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();