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
@@ -31,7 +31,7 @@ class MoonsAdminController extends Controller
/**
* Function to display the moons to admins
*/
public function displayMoonsAdmin() {
public function displayRentalMoonsAdmin() {
$this->middleware('role:Admin');
$lookupHelper = new LookupHelper;
+45 -3
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();
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class AllianceMoons extends Model
{
// Table Name
protected $table = 'alliance_moons';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = false;
/**
* The fillable items for each entry
*
* @var array
*/
protected $fillable = [
'Region',
'System',
'Planet',
'Moon',
'Corporation',
'FirstOre',
'FirstQuantity',
'SecondOre',
'SecondQuantity',
'ThirdOre',
'ThirdQuantity',
'FourthOre',
'FourthQuantity',
'Available',
];
}
+1 -1
View File
@@ -109,7 +109,7 @@ class User extends Authenticatable
}
public function getUserType() {
return User::where('user_type')->get();
return $this->user_type;
}
public function getRole() {