removing a bunch of unused tables in the database

This commit is contained in:
2019-12-12 18:04:33 -06:00
parent 95e58ab6d1
commit 29c1986204
10 changed files with 42 additions and 191 deletions
+3 -50
View File
@@ -6,13 +6,15 @@
namespace App\Library\Finances;
//Internal Library
use DB;
use Carbon\Carbon;
//Library
use App\Library\Esi\Esi;
//Models
use App\Models\Finances\JumpBridgeJournal;
use App\Models\User\UserToCorporation;
class JumpBridgeTax {
private $date;
@@ -76,55 +78,6 @@ class JumpBridgeTax {
}
}
/**
* Function to get the corporations using the jump bridge over a given time period
*/
public function CorporationUsage() {
//Make an array for corporations, and amounts
$amounts = array();
$characters = array();
$data = array();
$esi = new Esi();
//Get all of the parties which have utilized the jump bridge
$parties = DB::table('jump_bridge_journal')
->select('first_party_id')
->groupBy('first_party_id')
->whereTime('date', '>', $this->date)
->get();
//Run through each party and assign them into a corporation, then add the corporation to the corporation array if they don't
//exist in the array.
foreach($parties as $party) {
//If the entry in the database lookup table isn't found, add it.
if(!CharacterToCorporation::where(['character_id' => $party->first_party_id])->exists()) {
$character = $esi->GetCharacterData($party->first_party_id);
$corporation = $esi->GetCorporationData($character->corporation_id);
$char = new CharacterToCorporation;
$char->character_id = $party->first_party_id;
$char->character_name = $character->name;
$char->corporation_id = $character->corporation_id;
$char->corporation_name = $corporation->name;
$char->save();
}
//Perform the lookup and add the user into the corps array, and the ammount to the amount array
$char = CharacterToCorporation::where(['character_id' => $party->first_party_id])->get();
//Find the amount utilized from the jump bridge by the character
$isk = JumpBridgeJournal::where(['first_party_id' => $char->character_id])
->whereBetween('date', [$this->date, $this->date->addDays(30)])
->sum('amount');
//We have the character and isk amount, so we need to build an array with these two values as key value pairs.
$data[$char->corporation_name] = $data[$char->corporation_name] + $isk;
}
//Return the data
return $data;
}
/**
* Returns the overall usage for statistics
*/
-2
View File
@@ -15,8 +15,6 @@ use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
//Models
use App\Models\Lookups\CharacterToCorporation;
use App\Models\Lookups\CorporationToAlliance;
use App\Models\Lookups\CharacterLookup;
use App\Models\Lookups\CorporationLookup;
use App\Models\Lookups\AllianceLookup;
@@ -1,26 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class CorpMarketStructure extends Model
{
//Table Name
public $table = 'corp_market_structures';
//Timestamps
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'character_id',
'corporation_id',
'tax',
'ratio',
];
}
@@ -1,26 +0,0 @@
<?php
namespace App\Models\Lookups;
use Illuminate\Database\Eloquent\Model;
class CharacterToCorporation extends Model
{
// Table Name
public $table = 'character_to_corporation';
// Timestamps
public $timestamps = false;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'character_id',
'character_name',
'corporation_id',
'corporation_name',
];
}
@@ -1,26 +0,0 @@
<?php
namespace App\Models\Lookups;
use Illuminate\Database\Eloquent\Model;
class CorporationToAlliance extends Model
{
//Table Name
public $table = 'corporation_to_alliance';
//Timestamps
public $timestamps = false;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'corporation_id',
'corporation_name',
'alliance_id',
'alliance_name',
];
}
@@ -1,27 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SolarSystemDistance extends Model
{
//Table Name
public $table = 'solar_system_distances';
//Timestamps
public $timestamps = false;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'start_id',
'start_name',
'end_id',
'end_name',
'distance',
];
}
-26
View File
@@ -1,26 +0,0 @@
<?php
namespace App\Models\Lookups;
use Illuminate\Database\Eloquent\Model;
class UserToCorporation extends Model
{
// Table Name
public $table = 'user_to_corporation';
// Timestamps
public $timestamps = false;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'character_id',
'character_name',
'corporation_id',
'corporation_name',
];
}