Added new models for Lookup Tables
Added new Library class called LookupHelper to assist in easier access to reference tables across all classes. Added lookup table migrations Added chartjs package to composer, and laravel service provider modified routes to make it easier to see what is going on rather than having different names for post things from get pages
This commit is contained in:
@@ -22,8 +22,6 @@ class MoonsAdminController extends Controller
|
||||
}
|
||||
|
||||
public function showJournalEntries() {
|
||||
$esi = new Esi();
|
||||
|
||||
$dateInit = Carbon::now();
|
||||
$date = $dateInit->subDays(30);
|
||||
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Library;
|
||||
|
||||
use DB;
|
||||
|
||||
use App\Models\Esi\EsiScope;
|
||||
|
||||
use Seat\Eseye\Cache\NullCache;
|
||||
use Seat\Eseye\Configuration;
|
||||
use Seat\Eseye\Containers\EsiAuthentication;
|
||||
use Seat\Eseye\Eseye;
|
||||
|
||||
/**
|
||||
* This class represents a few ESI helper functions for the program
|
||||
*/
|
||||
class Esi {
|
||||
|
||||
/**
|
||||
* Check if a scope is in the database for a particular character
|
||||
*
|
||||
* @param charId
|
||||
* @param scope
|
||||
*
|
||||
* @return true,false
|
||||
*/
|
||||
public function HaveEsiScope($charId, $scope) {
|
||||
//Check for an esi scope
|
||||
$checks = DB::table('EsiScopes')->where('character_id', $charId)->get();
|
||||
foreach($checks as $check) {
|
||||
if($check->scope === $scope) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function GetCharacterName($charId) {
|
||||
$esi = new Eseye();
|
||||
$character = $esi->invoke('get', '/characters/{character_id}/', [
|
||||
'character_id' => $charId,
|
||||
]);
|
||||
|
||||
return $character->name;
|
||||
}
|
||||
|
||||
public function FindCharacterId($name) {
|
||||
$config = config('esi');
|
||||
//Create the esi authentication container
|
||||
$authentication = new EsiAuthentication([
|
||||
'client_id' => $config['client_id'],
|
||||
'secret' => $config['secret'],
|
||||
]);
|
||||
//Create the esi container
|
||||
$esi = new Eseye($authentication);
|
||||
$character = $esi->setQueryString([
|
||||
'categories' => 'character',
|
||||
'language' => 'en-us',
|
||||
'search' => $name,
|
||||
'strict' => 'true',
|
||||
])->invoke('get', '/search/');
|
||||
|
||||
$character = json_decode($character, true);
|
||||
|
||||
return $character['character'];
|
||||
}
|
||||
|
||||
public function FindCorporationId($charId) {
|
||||
$esi = new Eseye();
|
||||
$character = $esi->invoke('get', '/characters/{character_id}/', [
|
||||
'character_id' => $charId,
|
||||
]);
|
||||
|
||||
return $character->corporation_id;
|
||||
}
|
||||
|
||||
public function FindCorporationName($charId) {
|
||||
$esi = new Eseye();
|
||||
$character = $esi->invoke('get', '/characters/{character_id}/', [
|
||||
'character_id' => $charId,
|
||||
]);
|
||||
|
||||
$corporation = $esi->invoke('get', '/corporations/{corporation_id}/', [
|
||||
'corporation_id' => $character->corporation_id,
|
||||
]);
|
||||
|
||||
return $corporation->name;
|
||||
}
|
||||
|
||||
public function DecodeDate($date) {
|
||||
//Find the end of the date
|
||||
$dateEnd = strpos($date, "T");
|
||||
//Split the string up into date and time
|
||||
$dateArr = str_split($date, $dateEnd);
|
||||
//Trim the T and Z from the end of the second item in the array
|
||||
$dateArr[1] = ltrim($dateArr[1], "T");
|
||||
$dateArr[1] = rtrim($dateArr[1], "Z");
|
||||
//Combine the date
|
||||
$realDate = $dateArr[0] . " " . $dateArr[1];
|
||||
|
||||
//Return the combined date in the correct format
|
||||
return $realDate;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,227 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* W4RP Services
|
||||
* GNU Public License
|
||||
*/
|
||||
|
||||
namespace App\Library;
|
||||
|
||||
use DB;
|
||||
|
||||
use App\Models\Esi\EsiScope;
|
||||
use App\Models\Esi\EsiToken;
|
||||
use App\Models\Corporation\CorpJournal;
|
||||
use App\Models\User\UserToCorporation;
|
||||
use App\Models\Finances\PlayerDonationJournal;
|
||||
|
||||
use App\Library\Esi;
|
||||
|
||||
use Seat\Eseye\Cache\NullCache;
|
||||
use Seat\Eseye\Configuration;
|
||||
use Seat\Eseye\Containers\EsiAuthentication;
|
||||
use Seat\Eseye\Eseye;
|
||||
|
||||
class FinanceHelper {
|
||||
|
||||
public function GetWalletJournal($division, $charId) {
|
||||
//Get hte ESI token for the corporation to add new wallet journals into the database
|
||||
$token = DB::table('EsiTokens')->where('character_id', $charId)->get();
|
||||
|
||||
//Reference to see if the character is in our look up table for corporations and characters
|
||||
$corpId = $this->GetCharCorp($charId);
|
||||
|
||||
//Disable all caching by setting the NullCache as the preferred cache handler.
|
||||
$configuration = Configuration::getInstance();
|
||||
$configuration->cache = NullCache::class;
|
||||
|
||||
//Create an ESI authentication container
|
||||
$config = config('esi');
|
||||
$authentication = new EsiAuthentication([
|
||||
'client_id' => $config['client_id'],
|
||||
'secret' => $config['secret'],
|
||||
'refresh_token' => $token[0]->refresh_token,
|
||||
]);
|
||||
|
||||
//Create the esi class varialble
|
||||
$esi = new Eseye($authentication);
|
||||
|
||||
//Set our current page to 1 which is the one we are starting on.
|
||||
$currentPage = 1;
|
||||
//Set our default total pages to 1 in case our try section fails out.
|
||||
$totalPages = 1;
|
||||
|
||||
//If more than one page is found, decode the first set of wallet entries, then call for the next pages
|
||||
do {
|
||||
//Call the first page of the wallet journal, as we are always going to get at least one page.
|
||||
//If we have more pages, then we will continue through the while loop.
|
||||
try {
|
||||
$journals = $esi->page($currentPage)
|
||||
->invoke('get', '/corporations/{corporation_id}/wallets/{division}/journal/', [
|
||||
'corporation_id' => $corpId,
|
||||
'division' => $division,
|
||||
]);
|
||||
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e) {
|
||||
return $e->getEsiResponse();
|
||||
}
|
||||
|
||||
//Set the total pages we need to cycle through.
|
||||
$totalPages = $journals->pages;
|
||||
//Decode the wallet from json into an array
|
||||
$wallet = json_decode($journals->raw, true);
|
||||
//For each journal entry, attempt to store it in the database.
|
||||
//The PutWalletJournal function checks to see if it's already in the database.
|
||||
foreach($wallet as $entry) {
|
||||
if($entry['amount'] > 0) {
|
||||
if($entry['ref_type'] == 'brokers_fee' ||
|
||||
$entry['ref_type'] == 'reprocessing_tax' ||
|
||||
$entry['ref_type'] == 'jumpgate_fee' ||
|
||||
$entry['ref_type'] == 'player_donation' ||
|
||||
($entry['ref_type'] == 'corporation_account_withdrawal' && $entry['second_party_id'] == 98287666)) {
|
||||
$this->PutWalletJournal($entry, $corpId, $division);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Increment the current page we are on.
|
||||
$currentPage++;
|
||||
//Continue looping through the do while loop until the current page is greater than or equal to the total pages.
|
||||
} while ($currentPage < $totalPages);
|
||||
|
||||
return $currentPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the corporation a character is in if found in the lookup table, otherwise,
|
||||
* adds the character to the lookup table, and returns the corporation id
|
||||
*
|
||||
* @param charId
|
||||
* @return corpId
|
||||
*/
|
||||
private function GetCharCorp($charId) {
|
||||
//Check for the character the user_to_corporation table
|
||||
//$found = DB::table('user_to_corporation')->where('character_id', $charId)->get();
|
||||
$found = UserToCorporation::where('character_id', $charId)->get(['corporation_id']);
|
||||
//If we don't find the character in the table, then let's retrieve the information from ESI
|
||||
if(!isset($found[0]->corporation_id)) {
|
||||
//Get the configuration for ESI from the environmental variables
|
||||
$config = config('esi');
|
||||
//Setup a new ESI container
|
||||
$esi = new Eseye();
|
||||
//Try to get the character information, then the corporation information
|
||||
try {
|
||||
$character = $esi->invoke('get', '/characters/{character_id}/', [
|
||||
'character_id' => $charId,
|
||||
]);
|
||||
$corporation = $esi->invoke('get', '/corporations/{corporation_id}/', [
|
||||
'corporation_id' => $character->corporation_id,
|
||||
]);
|
||||
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e){
|
||||
return $e->getEsiResponse();
|
||||
}
|
||||
|
||||
//Save all of the data to the database
|
||||
$char = new UserToCorporation;
|
||||
$char->character_id = $charId;
|
||||
$char->character_name = $character->name;
|
||||
$char->corporation_id = $character->corporation_id;
|
||||
$char->corporation_name = $corporation->name;
|
||||
$char->save();
|
||||
//Return the corporation_id which is what the calling function is looking for
|
||||
return $character->corporation_id;
|
||||
} else {
|
||||
//Return the corporation_id if it was found in the database as it is what the calling function is looking for
|
||||
return $found[0]->corporation_id;
|
||||
}
|
||||
}
|
||||
|
||||
private function PutWalletJournal($journal, $corpId, $division) {
|
||||
//Create ESI Helper class
|
||||
$esiHelper = new Esi;
|
||||
$date = $esiHelper->DecodeDate($journal['date']);
|
||||
|
||||
if($journal['ref_type'] == 'player_donation' || ($journal['ref_type'] == 'corporation_account_withdrawal' && $journal['second_party_id'] == 98287666)) {
|
||||
//if we don't find the journal entry, add the journal entry to the database
|
||||
if(!PlayerDonationJournal::where(['id' => $journal['id']])->exists()) {
|
||||
$entry = new PlayerDonationJournal;
|
||||
$entry->id = $journal['id'];
|
||||
$entry->corporation_id = $corpId;
|
||||
$entry->division = $division;
|
||||
if(isset($journal['amount'])) {
|
||||
$entry->amount = $journal['amount'];
|
||||
}
|
||||
if(isset($journal['balance'])) {
|
||||
$entry->balance = $journal['balance'];
|
||||
}
|
||||
if(isset($journal['context_id'])) {
|
||||
$entry->context_id = $journal['context_id'];
|
||||
}
|
||||
if(isset($journal['context_id_type'])) {
|
||||
$entry->context_id_type = $journal['context_id_type'];
|
||||
}
|
||||
$entry->date = $date;
|
||||
$entry->description = $journal['description'];
|
||||
if(isset($journal['first_party_id'])) {
|
||||
$entry->first_party_id = $journal['first_party_id'];
|
||||
}
|
||||
if(isset($journal['reason'])) {
|
||||
$entry->reason = $journal['reason'];
|
||||
}
|
||||
$entry->ref_type = $journal['ref_type'];
|
||||
if(isset($journal['second_party_id'])) {
|
||||
$entry->second_party_id = $journal['second_party_id'];
|
||||
}
|
||||
if(isset($journal['tax'])) {
|
||||
$entry->tax = $journal['tax'];
|
||||
}
|
||||
if(isset($journal['tax_receiver_id'])) {
|
||||
$entry->tax_receiver_id = $journal['tax_receiver_id'];
|
||||
}
|
||||
$entry->save();
|
||||
}
|
||||
} else {
|
||||
//if we don't find the journal entry, add the journal entry to the database
|
||||
if(!CorpJournal::where(['id' => $journal['id']])->exists()) {
|
||||
$entry = new CorpJournal;
|
||||
$entry->id = $journal['id'];
|
||||
$entry->corporation_id = $corpId;
|
||||
$entry->division = $division;
|
||||
if(isset($journal['amount'])) {
|
||||
$entry->amount = $journal['amount'];
|
||||
}
|
||||
if(isset($journal['balance'])) {
|
||||
$entry->balance = $journal['balance'];
|
||||
}
|
||||
if(isset($journal['context_id'])) {
|
||||
$entry->context_id = $journal['context_id'];
|
||||
}
|
||||
if(isset($journal['context_id_type'])) {
|
||||
$entry->context_id_type = $journal['context_id_type'];
|
||||
}
|
||||
$entry->date = $date;
|
||||
$entry->description = $journal['description'];
|
||||
if(isset($journal['first_party_id'])) {
|
||||
$entry->first_party_id = $journal['first_party_id'];
|
||||
}
|
||||
if(isset($journal['reason'])) {
|
||||
$entry->reason = $journal['reason'];
|
||||
}
|
||||
$entry->ref_type = $journal['ref_type'];
|
||||
if(isset($journal['second_party_id'])) {
|
||||
$entry->second_party_id = $journal['second_party_id'];
|
||||
}
|
||||
if(isset($journal['tax'])) {
|
||||
$entry->tax = $journal['tax'];
|
||||
}
|
||||
if(isset($journal['tax_receiver_id'])) {
|
||||
$entry->tax_receiver_id = $journal['tax_receiver_id'];
|
||||
}
|
||||
$entry->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -105,7 +105,6 @@ class FinanceHelper {
|
||||
*/
|
||||
private function GetCharCorp($charId) {
|
||||
//Check for the character the user_to_corporation table
|
||||
//$found = DB::table('user_to_corporation')->where('character_id', $charId)->get();
|
||||
$found = UserToCorporation::where('character_id', $charId)->get(['corporation_id']);
|
||||
//If we don't find the character in the table, then let's retrieve the information from ESI
|
||||
if(!isset($found[0]->corporation_id)) {
|
||||
|
||||
@@ -7,12 +7,27 @@
|
||||
namespace App\Library\Finances;
|
||||
|
||||
use DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Library\Esi;
|
||||
|
||||
use App\Models\Finances\JumpBridgeJournal;
|
||||
use App\Models\User\UserToCorporation;
|
||||
|
||||
class JumpBridgeTax {
|
||||
private $date;
|
||||
|
||||
public function __construct($days = null) {
|
||||
if($days === null) {
|
||||
$this->date = Carbon::now();
|
||||
} else {
|
||||
$this->date = Carbon::now()->subDays($days);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to insert journal entries into the database
|
||||
*/
|
||||
public function InsertJumpBridgeTax($journal, $corpId, $division) {
|
||||
//Create the ESI Helper class
|
||||
$esiHelper = new Esi;
|
||||
@@ -57,4 +72,59 @@ class JumpBridgeTax {
|
||||
$entry->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the corporations using the jump bridge over a given time period
|
||||
*/
|
||||
public function CorporationUsage() {
|
||||
//Make an array for corporations, and amounts
|
||||
$corps = array();
|
||||
$amounts = array();
|
||||
|
||||
//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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the overall usage for statistics
|
||||
*/
|
||||
public function OverallTax() {
|
||||
//Initalize the date
|
||||
$dateInit = Carbon::now();
|
||||
//Subtract the days from now
|
||||
$date = $dateInit->subDays($days);
|
||||
|
||||
//Get the total usage
|
||||
$usage = DB::table('jump_bridge_journal')
|
||||
->select('amount')
|
||||
->whereTime('date', '>', $this->date)
|
||||
->sum(['amount']);
|
||||
|
||||
//Return the usage
|
||||
return $usage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a specific briddge usage statistics for overall usage
|
||||
*/
|
||||
public function JBOverallUsage($structure) {
|
||||
$usage = DB::table('jump_bridge_journal')
|
||||
->select('amount')
|
||||
->where('context_id', $structure)
|
||||
->sum(['amount']);
|
||||
|
||||
return $usage;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Library;
|
||||
|
||||
use Auth;
|
||||
use Session;
|
||||
use DB;
|
||||
|
||||
use App\Models\Esi\EsiToken;
|
||||
use App\Models\Fleet\Fleet;
|
||||
use App\Models\Fleet\FleetActivity;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use Seat\Eseye\Cache\NullCache;
|
||||
use Seat\Eseye\Configuration;
|
||||
use Seat\Eseye\Containers\EsiAuthentication;
|
||||
use Seat\Eseye\Eseye;
|
||||
|
||||
class FleetHelper {
|
||||
|
||||
private $fleetUri;
|
||||
private $fcId;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param fcId
|
||||
*/
|
||||
public function __construct($charId = null, $fleetId = null) {
|
||||
$this->fcId = $charId;
|
||||
$this->fleet = $fleetId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Fleet number
|
||||
*
|
||||
* @param fleetUri
|
||||
*/
|
||||
public function SetFleetUri($fleetUri) {
|
||||
//Trim the left side of the fleet number
|
||||
$uris = explode('https://esi.tech.ccp.is/v1/fleets/', $fleetUri);
|
||||
//Trim the right side of the fleet number
|
||||
$fleetUri = rtrim($uris[1], '/?datasource=tranquility');
|
||||
$this->fleetUri = $fleetUri;
|
||||
}
|
||||
|
||||
public function GetFleetUri() {
|
||||
return $this->fleetUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update fleet motd and free move.
|
||||
*
|
||||
* @param fleetId
|
||||
*/
|
||||
public function UpdateFleet($fleetId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to add a pilot to the fleet using his character id
|
||||
*
|
||||
* @param fc
|
||||
* @param charId
|
||||
* @param fleetId
|
||||
*/
|
||||
public function AddPilot($fc, $charId, $fleetId) {
|
||||
|
||||
//Get the ESI token for the FC to add the new pilot
|
||||
$token = DB::table('EsiTokens')->where('character_id', $fc)->get();
|
||||
// Disable all caching by setting the NullCache as the
|
||||
// preferred cache handler. By default, Eseye will use the
|
||||
// FileCache.
|
||||
$configuration = Configuration::getInstance();
|
||||
$configuration->cache = NullCache::class;
|
||||
//Create the ESI Call Container
|
||||
$config = config('esi');
|
||||
$authentication = new EsiAuthentication([
|
||||
'client_id' => $config['client_id'],
|
||||
'secret' => $config['secret'],
|
||||
'refresh_token' => $token[0]->refresh_token,
|
||||
]);
|
||||
$esi = new \Seat\Eseye\Eseye($authentication);
|
||||
|
||||
try {
|
||||
//Setup the body of the esi message and perform the call
|
||||
$esi->setBody([
|
||||
'character_id' => $charId,
|
||||
'role' => 'squad_member',
|
||||
])->invoke('post', '/fleets/{fleet_id}/members/', [
|
||||
'fleet_id' => $fleetId,
|
||||
]);
|
||||
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e) {
|
||||
return $e->getEsiResponse();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store Fleet Activity Tracking information into the database when caleld
|
||||
*
|
||||
* @param fleetId
|
||||
*/
|
||||
public function StoreFleetActivity($fleetId, $fcId) {
|
||||
//Get the ESI token for the FC to get the fleet composition
|
||||
$token = DB::table('EsiTokens')->where('character_id', $fcId)->get();
|
||||
//Disable all caching by setting the NullCache as the preferred cache handler.
|
||||
$configuration = Configuration::getInstance();
|
||||
$configuration->cache = NullCache::class;
|
||||
//Create the ESI Call Container
|
||||
$config = config('esi');
|
||||
$authentication = new EsiAuthentication([
|
||||
'client_id' => $config['client_id'],
|
||||
'secret' => $config['secret'],
|
||||
'refresh_token' => $token[0]->refresh_token,
|
||||
]);
|
||||
$esi = new Eseye($authentication);
|
||||
|
||||
try {
|
||||
$fleetComp = $esi->invoke('get', '/fleets/{fleet_id}/members/', [
|
||||
'fleet_id' => $fleetId,
|
||||
]);
|
||||
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e) {
|
||||
return $e->getEsiResponse();
|
||||
}
|
||||
dd($fleetComp);
|
||||
foreach($fleetComp as $comp) {
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
43
app/Library/Lookups/LookupHelper.php
Normal file
43
app/Library/Lookups/LookupHelper.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Library\Lookups;
|
||||
|
||||
use DB;
|
||||
|
||||
use App\Models\User\UserToCorporation;
|
||||
|
||||
use Seat\Eseye\Cache\NullCache;
|
||||
use Seat\Eseye\Configuration;
|
||||
use Seat\Eseye\Containers\EsiAuthentication;
|
||||
use Seat\Eseye\Eseye;
|
||||
|
||||
class LookupHelper {
|
||||
|
||||
//Add characters to the lookup table for quicker lookups without having
|
||||
//to hit the ESI all the time
|
||||
public function LookupCharacter($charId) {
|
||||
//Check for the character in the user_to_corporation table
|
||||
$found = UserToCorporation::where('character_id', $charId)->get(['corporation_id']);
|
||||
|
||||
//If we don't find the character in the table, then we retrieve from ESI
|
||||
//and add the character to the table
|
||||
}
|
||||
|
||||
//Update the character lookup table as often as necessary
|
||||
public function UpdateLookupCharacter() {
|
||||
|
||||
}
|
||||
|
||||
//Add corporations to the lookup table for quicker lookups without having to
|
||||
//hit the ESI API all the time
|
||||
public function LookupCorporation($corpId) {
|
||||
|
||||
}
|
||||
|
||||
//Update the corporation lookup table as often as necessary
|
||||
public function UpdateLookupCorporation() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Library;
|
||||
|
||||
use DB;
|
||||
|
||||
use App\Models\Esi\EsiScope;
|
||||
use App\Models\Esi\Esitoken;
|
||||
|
||||
use Seat\Eseye\Cache\NullCache;
|
||||
use Seat\Eseye\Configuration;
|
||||
use Seat\Eseye\Containers\EsiAuthentication;
|
||||
use Seat\Eseye\Eseye;
|
||||
|
||||
class Mail {
|
||||
|
||||
public function SendMail($charId, $taxAmount, $subject, $body) {
|
||||
//Retrieve the token for Amund Risalo
|
||||
$token = DB::table('EsiTokens')->where('character_id', 93738489)->get();
|
||||
$configuration = Configuration::getInstance();
|
||||
$configuration->cache = NullCache::class;
|
||||
//Create the ESI authentication container
|
||||
$config = config('esi');
|
||||
$authentication = new EsiAuthentication([
|
||||
'client_id' => $config['client_id'],
|
||||
'secret' => $config['secret'],
|
||||
'refresh_token' => $token[0]->refresh_token,
|
||||
]);
|
||||
//Create the esi class variable
|
||||
$esi = new Eseye($authentication);
|
||||
try {
|
||||
$esi->setBody([
|
||||
'body' => $body,
|
||||
'receipients' => [
|
||||
'recipient_id'=> $charId,
|
||||
'recipient_type' => 'character',
|
||||
],
|
||||
'subject' => $subject,
|
||||
])->invoke('post', '/characters/{character_id}/mail/', [
|
||||
'character_id' => 93738489,
|
||||
]);
|
||||
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e) {
|
||||
return $e->getEsiResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,541 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* W4RP Services
|
||||
* GNU Public License
|
||||
*/
|
||||
|
||||
namespace App\Library;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Session;
|
||||
use DB;
|
||||
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
use App\Models\Config;
|
||||
use App\Models\Moon\Moon;
|
||||
use App\Models\Moon\Price;
|
||||
use App\Models\Moon\ItemComposition;
|
||||
|
||||
class MoonCalc {
|
||||
|
||||
public function SpatialMoonsTotalWorth($firstOre, $firstQuan, $secondOre, $secondQuan, $thirdOre, $thirdQuan, $fourthOre, $fourthQuan) {
|
||||
//Always assume a 1 month pull which equates to 5.55m3 per second or 2,592,000 seconds
|
||||
//Total pull size is 14,385,600 m3
|
||||
$totalPull = 5.55 * (3600.00 * 24.00 * 30.00);
|
||||
//Get the configuration for pricing calculations
|
||||
$config = DB::table('Config')->get();
|
||||
if($firstQuan >= 1.00) {
|
||||
$firstPerc = $this->ConvertToPercentage($firstQuan);
|
||||
} else {
|
||||
$firstPerc = $firstQuan;
|
||||
}
|
||||
if($secondQuan >= 1.00) {
|
||||
$secondPerc = $this->ConvertToPercentage($secondQuan);
|
||||
} else {
|
||||
$secondPerc = $secondQuan;
|
||||
}
|
||||
if($thirdQuan >= 1.00) {
|
||||
$thirdPerc = $this->ConvertToPercentage($thirdQuan);
|
||||
} else {
|
||||
$thirdPerc = $thirdQuan;
|
||||
}
|
||||
if($fourthQuan >= 1.00) {
|
||||
$fourthPerc = $this->ConvertToPercentage($fourthQuan);
|
||||
} else {
|
||||
$fourthPerc = $fourthQuan;
|
||||
}
|
||||
if($firstOre != "None") {
|
||||
$firstTotal = $this->CalcPrice($firstOre, $firstPerc);
|
||||
} else {
|
||||
$firstTotal = 0.00;
|
||||
}
|
||||
if($secondOre != "None") {
|
||||
$secondTotal = $this->CalcPrice($secondOre, $secondPerc);
|
||||
} else {
|
||||
$secondTotal = 0.00;
|
||||
}
|
||||
if($thirdOre != "None") {
|
||||
$thirdTotal = $this->CalcPrice($thirdOre, $thirdPerc);
|
||||
} else {
|
||||
$thirdTotal = 0.00;
|
||||
}
|
||||
if($fourthOre != "None") {
|
||||
$fourthTotal = $this->CalcPrice($fourthOre, $fourthPerc);
|
||||
} else {
|
||||
$fourthTotal = 0.00;
|
||||
}
|
||||
//Calculate the total to price to be mined in one month
|
||||
$totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
|
||||
|
||||
//Return the rental price to the caller
|
||||
return $totalPriceMined;
|
||||
}
|
||||
|
||||
public function SpatialMoonsOnlyGooTotalWorth($firstOre, $firstQuan, $secondOre, $secondQuan, $thirdOre, $thirdQuan, $fourthOre, $fourthQuan) {
|
||||
//Always assume a 1 month pull which equates to 5.55m3 per second or 2,592,000 seconds
|
||||
//Total pull size is 14,385,600 m3
|
||||
$totalPull = 5.55 * (3600.00 * 24.00 * 30.00);
|
||||
//Get the configuration for pricing calculations
|
||||
$config = DB::table('Config')->get();
|
||||
if($firstQuan >= 1.00) {
|
||||
$firstPerc = $this->ConvertToPercentage($firstQuan);
|
||||
} else {
|
||||
$firstPerc = $firstQuan;
|
||||
}
|
||||
if($secondQuan >= 1.00) {
|
||||
$secondPerc = $this->ConvertToPercentage($secondQuan);
|
||||
} else {
|
||||
$secondPerc = $secondQuan;
|
||||
}
|
||||
if($thirdQuan >= 1.00) {
|
||||
$thirdPerc = $this->ConvertToPercentage($thirdQuan);
|
||||
} else {
|
||||
$thirdPerc = $thirdQuan;
|
||||
}
|
||||
if($fourthQuan >= 1.00) {
|
||||
$fourthPerc = $this->ConvertToPercentage($fourthQuan);
|
||||
} else {
|
||||
$fourthPerc = $fourthQuan;
|
||||
}
|
||||
if($firstOre != "None") {
|
||||
if($this->IsRMoonGoo($firstOre)) {
|
||||
$firstTotal = $this->CalcPrice($firstOre, $firstPerc);
|
||||
} else {
|
||||
$firstTotal = 0.00;
|
||||
}
|
||||
} else {
|
||||
$firstTotal = 0.00;
|
||||
}
|
||||
if($secondOre != "None") {
|
||||
if($this->IsRMoonGoo($secondOre)) {
|
||||
$secondTotal = $this->CalcPrice($secondOre, $secondPerc);
|
||||
} else {
|
||||
$secondTotal = 0.00;
|
||||
}
|
||||
} else {
|
||||
$secondTotal = 0.00;
|
||||
}
|
||||
if($thirdOre != "None") {
|
||||
if($this->IsRMoonGoo($thirdOre)) {
|
||||
$thirdTotal = $this->CalcPrice($thirdOre, $thirdPerc);
|
||||
} else {
|
||||
$thirdTotal = 0.00;
|
||||
}
|
||||
} else {
|
||||
$thirdTotal = 0.00;
|
||||
}
|
||||
if($fourthOre != "None") {
|
||||
if($this->IsRMoonGoo($fourthOre)) {
|
||||
$fourthTotal = $this->CalcPrice($fourthOre, $fourthPerc);
|
||||
} else {
|
||||
$fourthTotal = 0.00;
|
||||
}
|
||||
} else {
|
||||
$fourthTotal = 0.00;
|
||||
}
|
||||
//Calculate the total to price to be mined in one month
|
||||
$totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
|
||||
|
||||
//Return the rental price to the caller
|
||||
return $totalPriceMined;
|
||||
}
|
||||
|
||||
public function SpatialMoonsOnlyGoo($firstOre, $firstQuan, $secondOre, $secondQuan, $thirdOre, $thirdQuan, $fourthOre, $fourthQuan) {
|
||||
//Always assume a 1 month pull which equates to 5.55m3 per second or 2,592,000 seconds
|
||||
//Total pull size is 14,385,600 m3
|
||||
$totalPull = 5.55 * (3600.00 * 24.00 * 30.00);
|
||||
//Get the configuration for pricing calculations
|
||||
$config = DB::table('Config')->get();
|
||||
if($firstQuan >= 1.00) {
|
||||
$firstPerc = $this->ConvertToPercentage($firstQuan);
|
||||
} else {
|
||||
$firstPerc = $firstQuan;
|
||||
}
|
||||
if($secondQuan >= 1.00) {
|
||||
$secondPerc = $this->ConvertToPercentage($secondQuan);
|
||||
} else {
|
||||
$secondPerc = $secondQuan;
|
||||
}
|
||||
if($thirdQuan >= 1.00) {
|
||||
$thirdPerc = $this->ConvertToPercentage($thirdQuan);
|
||||
} else {
|
||||
$thirdPerc = $thirdQuan;
|
||||
}
|
||||
if($fourthQuan >= 1.00) {
|
||||
$fourthPerc = $this->ConvertToPercentage($fourthQuan);
|
||||
} else {
|
||||
$fourthPerc = $fourthQuan;
|
||||
}
|
||||
if($firstOre != "None") {
|
||||
if($this->IsRMoon($firstOre)) {
|
||||
$firstTotal = $this->CalcPrice($firstOre, $firstPerc);
|
||||
} else {
|
||||
$firstTotal = 0.00;
|
||||
}
|
||||
} else {
|
||||
$firstTotal = 0.00;
|
||||
}
|
||||
if($secondOre != "None") {
|
||||
if($this->IsRMoon($secondOre)) {
|
||||
$secondTotal = $this->CalcPrice($secondOre, $secondPerc);
|
||||
} else {
|
||||
$secondTotal = 0.00;
|
||||
}
|
||||
} else {
|
||||
$secondTotal = 0.00;
|
||||
}
|
||||
if($thirdOre != "None") {
|
||||
if($this->IsRMoon($thirdOre)) {
|
||||
$thirdTotal = $this->CalcPrice($thirdOre, $thirdPerc);
|
||||
} else {
|
||||
$thirdTotal = 0.00;
|
||||
}
|
||||
} else {
|
||||
$thirdTotal = 0.00;
|
||||
}
|
||||
if($fourthOre != "None") {
|
||||
if($this->IsRMoon($fourthOre)) {
|
||||
$fourthTotal = $this->CalcPrice($fourthOre, $fourthPerc);
|
||||
} else {
|
||||
$fourthTotal = 0.00;
|
||||
}
|
||||
} else {
|
||||
$fourthTotal = 0.00;
|
||||
}
|
||||
//Calculate the total to price to be mined in one month
|
||||
$totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
|
||||
//Calculate the rental price. Refined rate is already included in the price from rental composition
|
||||
$rentalPrice['alliance'] = $totalPriceMined * ($config[0]->RentalTax / 100.00);
|
||||
$rentalPrice['outofalliance'] = $totalPriceMined * ($config[0]->AllyRentalTax / 100.00);
|
||||
//Format the rental price to the appropriate number
|
||||
$rentalPrice['alliance'] = number_format($rentalPrice['alliance'], "2", ".", ",");
|
||||
$rentalPrice['outofalliance'] = number_format($rentalPrice['outofalliance'], "2", ".", ",");
|
||||
|
||||
//Return the rental price to the caller
|
||||
return $rentalPrice;
|
||||
}
|
||||
|
||||
public function SpatialMoons($firstOre, $firstQuan, $secondOre, $secondQuan, $thirdOre, $thirdQuan, $fourthOre, $fourthQuan) {
|
||||
//Always assume a 1 month pull which equates to 5.55m3 per second or 2,592,000 seconds
|
||||
//Total pull size is 14,385,600 m3
|
||||
$totalPull = 5.55 * (3600.00 * 24.00 * 30.00);
|
||||
//Get the configuration for pricing calculations
|
||||
$config = DB::table('Config')->get();
|
||||
if($firstQuan >= 1.00) {
|
||||
$firstPerc = $this->ConvertToPercentage($firstQuan);
|
||||
} else {
|
||||
$firstPerc = $firstQuan;
|
||||
}
|
||||
if($secondQuan >= 1.00) {
|
||||
$secondPerc = $this->ConvertToPercentage($secondQuan);
|
||||
} else {
|
||||
$secondPerc = $secondQuan;
|
||||
}
|
||||
if($thirdQuan >= 1.00) {
|
||||
$thirdPerc = $this->ConvertToPercentage($thirdQuan);
|
||||
} else {
|
||||
$thirdPerc = $thirdQuan;
|
||||
}
|
||||
if($fourthQuan >= 1.00) {
|
||||
$fourthPerc = $this->ConvertToPercentage($fourthQuan);
|
||||
} else {
|
||||
$fourthPerc = $fourthQuan;
|
||||
}
|
||||
if($firstOre != "None") {
|
||||
$firstTotal = $this->CalcPrice($firstOre, $firstPerc);
|
||||
} else {
|
||||
$firstTotal = 0.00;
|
||||
}
|
||||
if($secondOre != "None") {
|
||||
$secondTotal = $this->CalcPrice($secondOre, $secondPerc);
|
||||
} else {
|
||||
$secondTotal = 0.00;
|
||||
}
|
||||
if($thirdOre != "None") {
|
||||
$thirdTotal = $this->CalcPrice($thirdOre, $thirdPerc);
|
||||
} else {
|
||||
$thirdTotal = 0.00;
|
||||
}
|
||||
if($fourthOre != "None") {
|
||||
$fourthTotal = $this->CalcPrice($fourthOre, $fourthPerc);
|
||||
} else {
|
||||
$fourthTotal = 0.00;
|
||||
}
|
||||
//Calculate the total to price to be mined in one month
|
||||
$totalPriceMined = $firstTotal + $secondTotal + $thirdTotal + $fourthTotal;
|
||||
//Calculate the rental price. Refined rate is already included in the price from rental composition
|
||||
$rentalPrice['alliance'] = $totalPriceMined * ($config[0]->RentalTax / 100.00);
|
||||
$rentalPrice['outofalliance'] = $totalPriceMined * ($config[0]->AllyRentalTax / 100.00);
|
||||
//Format the rental price to the appropriate number
|
||||
$rentalPrice['alliance'] = number_format($rentalPrice['alliance'], "2", ".", ",");
|
||||
$rentalPrice['outofalliance'] = number_format($rentalPrice['outofalliance'], "2", ".", ",");
|
||||
|
||||
//Return the rental price to the caller
|
||||
return $rentalPrice;
|
||||
}
|
||||
|
||||
public function FetchNewPrices() {
|
||||
$ItemIDs = array(
|
||||
"Tritanium" => 34,
|
||||
"Pyerite" => 35,
|
||||
"Mexallon" => 36,
|
||||
"Isogen" => 37,
|
||||
"Nocxium" => 38,
|
||||
"Zydrine" => 39,
|
||||
"Megacyte" => 40,
|
||||
"Morphite" => 11399,
|
||||
"HeliumIsotopes" => 16274,
|
||||
"NitrogenIsotopes" => 17888,
|
||||
"OxygenIsotopes" => 17887,
|
||||
"HydrogenIsotopes" => 17889,
|
||||
"LiquidOzone" => 16273,
|
||||
"HeavyWater" => 16272,
|
||||
"StrontiumClathrates" => 16275,
|
||||
"AtmosphericGases" => 16634,
|
||||
"EvaporiteDeposits" => 16635,
|
||||
"Hydrocarbons" => 16633,
|
||||
"Silicates" => 16636,
|
||||
"Cobalt" => 16640,
|
||||
"Scandium" => 16639,
|
||||
"Titanium" => 16638,
|
||||
"Tungsten" => 16637,
|
||||
"Cadmium" => 16643,
|
||||
"Platinum" => 16644,
|
||||
"Vanadium" => 16642,
|
||||
"Chromium" => 16641,
|
||||
"Technetium" => 16649,
|
||||
"Hafnium" => 16648,
|
||||
"Caesium" => 16647,
|
||||
"Mercury" => 16646,
|
||||
"Dysprosium" => 16650,
|
||||
"Neodymium" => 16651,
|
||||
"Promethium" => 16652,
|
||||
"Thulium" => 16653,
|
||||
);
|
||||
$time = time();
|
||||
$item = array();
|
||||
//Get the json data for each ItemId from https://market.fuzzwork.co.uk/api/
|
||||
//Base url is https://market.fuzzwork.co.uk/aggregates/?region=10000002&types=34
|
||||
//Going to use curl for these requests
|
||||
foreach($ItemIDs as $key => $value) {
|
||||
$client = new Client(['base_uri' => 'https://market.fuzzwork.co.uk/aggregates/']);
|
||||
$uri = '?region=10000002&types=' . $value;
|
||||
$result = $client->request('GET', $uri);
|
||||
$item = json_decode($result->getBody(), true);
|
||||
|
||||
DB::table('Prices')->where('Name', $key)->update([
|
||||
'Name' => $key,
|
||||
'ItemId' => $value,
|
||||
'Price' => $item[$value]['sell']['median'],
|
||||
'Time' => $time,
|
||||
]);
|
||||
}
|
||||
|
||||
$this->UpdateItemPricing();
|
||||
}
|
||||
|
||||
private function UpdateItemPricing() {
|
||||
|
||||
//Get the configuration from the config table
|
||||
$config = DB::table('Config')->first();
|
||||
//Calculate refine rate
|
||||
$refineRate = $config->RefineRate / 100.00;
|
||||
//Calculate the current time
|
||||
$time = time();
|
||||
//Get the max time from the database
|
||||
$maxTime = DB::table('Prices')->where('ItemId', 34)->max('Time');
|
||||
//Get the price of the basic minerals
|
||||
$tritaniumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [34, $maxTime]);
|
||||
$tritanium = DB::select( DB::raw('SELECT Price FROM Prices WHERE ItemId= :id AND Time= :time'), array('id' => 34, 'time' => $maxTime));
|
||||
$pyeritePrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [35, $maxTime]);
|
||||
$mexallonPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [36, $maxTime]);
|
||||
$isogenPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [37, $maxTime]);
|
||||
$nocxiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [38, $maxTime]);
|
||||
$zydrinePrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [39, $maxTime]);
|
||||
$megacytePrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [40, $maxTime]);
|
||||
$morphitePrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [11399, $maxTime]);
|
||||
$heliumIsotopesPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16274, $maxTime]);
|
||||
$nitrogenIsotopesPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [17888, $maxTime]);
|
||||
$oxygenIsotopesPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [17887, $maxTime]);
|
||||
$hydrogenIsotopesPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [17889, $maxTime]);
|
||||
$liquidOzonePrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16273, $maxTime]);
|
||||
$heavyWaterPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16272, $maxTime]);
|
||||
$strontiumClathratesPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16275, $maxTime]);
|
||||
//Get the price of the moongoo
|
||||
$atmosphericGasesPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16634, $maxTime]);
|
||||
$evaporiteDepositsPirce = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16635, $maxTime]);
|
||||
$hydrocarbonsPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16633, $maxTime]);
|
||||
$silicatesPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16636, $maxTime]);
|
||||
$cobaltPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16640, $maxTime]);
|
||||
$scandiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16639, $maxTime]);
|
||||
$titaniumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16638, $maxTime]);
|
||||
$tungstenPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16637, $maxTime]);
|
||||
$cadmiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16643, $maxTime]);
|
||||
$platinumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16644, $maxTime]);
|
||||
$vanadiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16642, $maxTime]);
|
||||
$chromiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16641, $maxTime]);
|
||||
$technetiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16649, $maxTime]);
|
||||
$hafniumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16648, $maxTime]);
|
||||
$caesiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16647, $maxTime]);
|
||||
$mercuryPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16646, $maxTime]);
|
||||
$dysprosiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16650, $maxTime]);
|
||||
$neodymiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16651, $maxTime]);
|
||||
$promethiumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16652, $maxTime]);
|
||||
$thuliumPrice = DB::select('SELECT Price FROM Prices WHERE ItemId = ? AND Time = ?', [16653, $maxTime]);
|
||||
//Get the item compositions
|
||||
$items = DB::select('SELECT Name,ItemId FROM ItemComposition');
|
||||
//Go through each of the items and update the price
|
||||
foreach($items as $item) {
|
||||
//Get the item composition
|
||||
$composition = DB::select('SELECT * FROM ItemComposition WHERE ItemId = ?', [$item->ItemId]);
|
||||
//Calculate the Batch Price
|
||||
$batchPrice = ( ($composition[0]->Tritanium * $tritaniumPrice[0]->Price) +
|
||||
($composition[0]->Pyerite * $pyeritePrice[0]->Price) +
|
||||
($composition[0]->Mexallon * $mexallonPrice[0]->Price) +
|
||||
($composition[0]->Isogen * $isogenPrice[0]->Price) +
|
||||
($composition[0]->Nocxium * $nocxiumPrice[0]->Price) +
|
||||
($composition[0]->Zydrine * $zydrinePrice[0]->Price) +
|
||||
($composition[0]->Megacyte * $megacytePrice[0]->Price) +
|
||||
($composition[0]->Morphite * $morphitePrice[0]->Price) +
|
||||
($composition[0]->HeavyWater * $heavyWaterPrice[0]->Price) +
|
||||
($composition[0]->LiquidOzone * $liquidOzonePrice[0]->Price) +
|
||||
($composition[0]->NitrogenIsotopes * $nitrogenIsotopesPrice[0]->Price) +
|
||||
($composition[0]->HeliumIsotopes * $heliumIsotopesPrice[0]->Price) +
|
||||
($composition[0]->HydrogenIsotopes * $hydrogenIsotopesPrice[0]->Price) +
|
||||
($composition[0]->OxygenIsotopes * $oxygenIsotopesPrice[0]->Price) +
|
||||
($composition[0]->StrontiumClathrates * $strontiumClathratesPrice[0]->Price) +
|
||||
($composition[0]->AtmosphericGases * $atmosphericGasesPrice[0]->Price) +
|
||||
($composition[0]->EvaporiteDeposits * $evaporiteDepositsPirce[0]->Price) +
|
||||
($composition[0]->Hydrocarbons * $hydrocarbonsPrice[0]->Price) +
|
||||
($composition[0]->Silicates * $silicatesPrice[0]->Price) +
|
||||
($composition[0]->Cobalt * $cobaltPrice[0]->Price) +
|
||||
($composition[0]->Scandium * $scandiumPrice[0]->Price) +
|
||||
($composition[0]->Titanium * $titaniumPrice[0]->Price) +
|
||||
($composition[0]->Tungsten * $tungstenPrice[0]->Price) +
|
||||
($composition[0]->Cadmium * $cadmiumPrice[0]->Price) +
|
||||
($composition[0]->Platinum * $platinumPrice[0]->Price) +
|
||||
($composition[0]->Vanadium * $vanadiumPrice[0]->Price) +
|
||||
($composition[0]->Chromium * $chromiumPrice[0]->Price)+
|
||||
($composition[0]->Technetium * $technetiumPrice[0]->Price) +
|
||||
($composition[0]->Hafnium * $hafniumPrice[0]->Price) +
|
||||
($composition[0]->Caesium * $caesiumPrice[0]->Price) +
|
||||
($composition[0]->Mercury * $mercuryPrice[0]->Price) +
|
||||
($composition[0]->Dysprosium * $dysprosiumPrice[0]->Price) +
|
||||
($composition[0]->Neodymium * $neodymiumPrice[0]->Price) +
|
||||
($composition[0]->Promethium * $promethiumPrice[0]->Price) +
|
||||
($composition[0]->Thulium * $thuliumPrice[0]->Price));
|
||||
//Calculate the batch price with the refine rate included
|
||||
//Batch Price is base price for everything
|
||||
$batchPrice = $batchPrice * $refineRate;
|
||||
//Calculate the unit price
|
||||
$price = $batchPrice / $composition[0]->BatchSize;
|
||||
//Calculate the m3 price
|
||||
$m3Price = $price / $composition[0]->m3Size;
|
||||
//Update the prices in the Prices table
|
||||
DB::table('OrePrices')->where('Name', $composition[0]->Name)->update([
|
||||
'Name' => $composition[0]->Name,
|
||||
'ItemId' => $composition[0]->ItemId,
|
||||
'BatchPrice' => $batchPrice,
|
||||
'UnitPrice' => $price,
|
||||
'm3Price' => $m3Price,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function CalcPrice($ore, $percentage) {
|
||||
//Specify the total pull amount
|
||||
$totalPull = 5.55 * (3600.00 * 24.00 * 30.00);
|
||||
//Find the size of the asteroid from the database
|
||||
$m3Size = DB::table('ItemComposition')->where('Name', $ore)->value('m3Size');
|
||||
//Calculate the actual m3 from the total pull amount in m3 using the percentage of the ingredient
|
||||
$actualm3 = floor($percentage * $totalPull);
|
||||
//Calculate the units once we have the size and actual m3 value
|
||||
$units = floor($actualm3 / $m3Size);
|
||||
//Look up the unit price from the database
|
||||
$unitPrice = DB::table('OrePrices')->where('Name', $ore)->value('UnitPrice');
|
||||
//Calculate the total amount from the units and unit price
|
||||
$total = $units * $unitPrice;
|
||||
//Return the value
|
||||
return $total;
|
||||
}
|
||||
|
||||
private function ConvertToPercentage($quantity) {
|
||||
return $quantity / 100.00;
|
||||
}
|
||||
|
||||
private function IsRMoonGoo($ore) {
|
||||
$ores = [
|
||||
'Zeolites' => 'Gas',
|
||||
'Sylvite' => 'Gas',
|
||||
'Bitumens' => 'Gas',
|
||||
'Coesite' => 'Gas',
|
||||
'Cobaltite' => 'R8',
|
||||
'Euxenite' => 'R8',
|
||||
'Titanite' => 'R8',
|
||||
'Scheelite' => 'R8',
|
||||
'Otavite' => 'R16',
|
||||
'Sperrylite' => 'R16',
|
||||
'Vanadinite' => 'R16',
|
||||
'Chromite' => 'R16',
|
||||
'Carnotite' => 'R32',
|
||||
'Zircon' => 'R32',
|
||||
'Pollucite' => 'R32',
|
||||
'Cinnabar' => 'R32',
|
||||
'Xenotime' => 'R64',
|
||||
'Monazite' => 'R64',
|
||||
'Loparite' => 'R64',
|
||||
'Ytterbite' => 'R64',
|
||||
];
|
||||
|
||||
foreach($ores as $key => $value) {
|
||||
|
||||
if(strtolower($key) == strtolower($ore)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function IsRMoon($ore) {
|
||||
$ores = [
|
||||
'Prime Arkonor' => 'Null',
|
||||
'Cubic Bistot' => 'Null',
|
||||
'Pellucid Crokite' => 'Null',
|
||||
'Jet Ochre' => 'Null',
|
||||
'Zeolites' => 'Gas',
|
||||
'Sylvite' => 'Gas',
|
||||
'Bitumens' => 'Gas',
|
||||
'Coesite' => 'Gas',
|
||||
'Cobaltite' => 'R8',
|
||||
'Euxenite' => 'R8',
|
||||
'Titanite' => 'R8',
|
||||
'Scheelite' => 'R8',
|
||||
'Otavite' => 'R16',
|
||||
'Sperrylite' => 'R16',
|
||||
'Vanadinite' => 'R16',
|
||||
'Chromite' => 'R16',
|
||||
'Carnotite' => 'R32',
|
||||
'Zircon' => 'R32',
|
||||
'Pollucite' => 'R32',
|
||||
'Cinnabar' => 'R32',
|
||||
'Xenotime' => 'R64',
|
||||
'Monazite' => 'R64',
|
||||
'Loparite' => 'R64',
|
||||
'Ytterbite' => 'R64',
|
||||
];
|
||||
|
||||
foreach($ores as $key => $value) {
|
||||
|
||||
if(strtolower($key) == strtolower($ore)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Library;
|
||||
|
||||
class MoonMine {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
26
app/Models/Charcter/CharacterToCorporation.php
Normal file
26
app/Models/Charcter/CharacterToCorporation.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Character;
|
||||
|
||||
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',
|
||||
];
|
||||
}
|
||||
26
app/Models/Corporation/CorporationToAlliance.php
Normal file
26
app/Models/Corporation/CorporationToAlliance.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Corporation;
|
||||
|
||||
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',
|
||||
];
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
"php": "^7.1.3",
|
||||
"eveseat/eseye": "^1.1",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"fx3costa/laravelchartjs": "^2.5",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"laravel/framework": "5.7.*",
|
||||
"laravel/socialite": "^3.1",
|
||||
|
||||
54
composer.lock
generated
54
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "c93c2bad68803ef801ac3588fdd86016",
|
||||
"content-hash": "f5600341130fc3a908febb1b7e6f5c1e",
|
||||
"packages": [
|
||||
{
|
||||
"name": "dnoegel/php-xdg-base-dir",
|
||||
@@ -417,6 +417,58 @@
|
||||
],
|
||||
"time": "2018-02-07T20:20:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "fx3costa/laravelchartjs",
|
||||
"version": "2.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fxcosta/laravel-chartjs.git",
|
||||
"reference": "ab1b987e12c477be2408f77df8c0506be0e7848b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fxcosta/laravel-chartjs/zipball/ab1b987e12c477be2408f77df8c0506be0e7848b",
|
||||
"reference": "ab1b987e12c477be2408f77df8c0506be0e7848b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "~5.1",
|
||||
"php": ">=5.6.4"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Fx3costa\\LaravelChartJs\\Providers\\ChartjsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Fx3costa\\LaravelChartJs\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Felix",
|
||||
"email": "fx3costa@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library",
|
||||
"keywords": [
|
||||
"chart",
|
||||
"chartjs",
|
||||
"fx3costa",
|
||||
"graphics",
|
||||
"laravel5",
|
||||
"reports"
|
||||
],
|
||||
"time": "2018-09-11T21:37:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "6.3.3",
|
||||
|
||||
@@ -153,6 +153,7 @@ return [
|
||||
Collective\Html\HtmlServiceProvider::class,
|
||||
//nullx27\Socialite\EveOnline\Providers\EveOnlineServiceProvider::class,
|
||||
Laravel\Socialite\SocialiteServiceProvider::class,
|
||||
Fx3costa\LaravelChartJs\Providers\ChartjsServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCharacterToCorporationTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if(!Schema::hasTable('character_to_corporation')) {
|
||||
Schema::create('character_to_corporation', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('character_id');
|
||||
$table->string('character_name');
|
||||
$table->string('corporation_id');
|
||||
$table->string('corporation_name');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('character_to_corporation');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCorporationToAllianceTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if(!Schema::hasTable('corporation_to_alliance')) {
|
||||
Schema::create('corporation_to_alliance', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('corporation_id');
|
||||
$table->string('corporation_name');
|
||||
$table->string('alliance_id');
|
||||
$table->string('alliance_name');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('corporation_to_alliance');
|
||||
}
|
||||
}
|
||||
@@ -30,25 +30,30 @@ Route::group(['middleware' => ['auth']], function(){
|
||||
|
||||
//Moon Admin Controller display pages
|
||||
Route::get('/moons/admin/addmoon', 'MoonsAdminController@addMoon');
|
||||
Route::post('/moons/admin/storeMoon', 'MoonsAdminController@storeMoon');
|
||||
Route::post('/moon/admin/addmoon', 'MoonsAdminController@storemoon');
|
||||
//Route::post('/moons/admin/storeMoon', 'MoonsAdminController@storeMoon');
|
||||
Route::get('/moons/admin/display', 'MoonsAdminController@displayMoonsAdmin');
|
||||
Route::post('/moons/admin/storeUpdateMoon', 'MoonsAdminController@storeUpdateMoon');
|
||||
//Route::post('/moons/admin/storeUpdateMoon', 'MoonsAdminController@storeUpdateMoon');
|
||||
Route::get('/moons/admin/updatemoon', 'MoonsAdminController@updateMoon');
|
||||
Route::post('/moons/admin/updatemoon', 'MoonsAdminController@storeUpdateMoon');
|
||||
Route::get('/moons/admin/journal', 'MoonsAdminController@showJournalEntries');
|
||||
|
||||
//Wiki Controller display pages
|
||||
Route::get('/wiki/register', 'WikiController@displayRegister');
|
||||
Route::post('/wiki/register', 'WikiController@storeRegister');
|
||||
Route::get('/wiki/changepassword', 'WikiController@displayChangePassword');
|
||||
Route::post('/wiki/storeRegister', 'WikiController@storeRegister');
|
||||
Route::post('/wiki/changePassword', 'WikiController@changePassword');
|
||||
Route::post('/wiki/changepassword', 'WikiController@changePassword');
|
||||
//Route::post('/wiki/storeRegister', 'WikiController@storeRegister');
|
||||
//Route::post('/wiki/changePassword', 'WikiController@changePassword');
|
||||
|
||||
//Fleet Controller display pages
|
||||
Route::get('/fleets/display', 'FleetsController@displayFleets');
|
||||
Route::get('/fleets/register', 'FleetsController@displayRegisterFleet');
|
||||
Route::post('/fleets/register', 'Fleetscontroller@registerFleet');
|
||||
Route::get('/fleets/{fleet_id}/addpilot/{id}', 'FleetsController@addPilot')->name('addpilot');
|
||||
Route::get('/fleets/{fleet_id}/addpilot/{name}', 'Fleetscontroller@addPilotName');
|
||||
Route::get('/fleets/{fleet_id}/delete', 'FleetsController@deleteFleet')->name('deletefleet');
|
||||
Route::post('/fleets/registerFleet', 'FleetsController@registerFleet');
|
||||
//Route::post('/fleets/registerFleet', 'FleetsController@registerFleet');
|
||||
|
||||
//Admin Controller display pages
|
||||
Route::get('/admin/dashboard', 'AdminController@displayDashboard');
|
||||
@@ -58,7 +63,8 @@ Route::group(['middleware' => ['auth']], function(){
|
||||
|
||||
//Register Structures Controller display pages
|
||||
Route::get('/structures/register', 'RegisterStructureController@displayRegisterstructure');
|
||||
Route::post('/structures/store', 'RegisterStructureController@storeStructure');
|
||||
Route::post('/structures/register', 'RegisterstructureController@storeStructure');
|
||||
//Route::post('/structures/store', 'RegisterStructureController@storeStructure');
|
||||
//Structure Controller display pages
|
||||
Route::get('/structures/taxes/display', 'StructureController@displayTaxes');
|
||||
Route::get('/structures/admin/taxes/display', 'StructureController@chooseCorpTaxes');
|
||||
|
||||
19
vendor/composer/autoload_classmap.php
vendored
19
vendor/composer/autoload_classmap.php
vendored
@@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'App\\CharacterToCorporation' => $baseDir . '/app/Models/Charcter/CharacterToCorporation.php',
|
||||
'App\\Console\\Commands\\CalculateMarketTax' => $baseDir . '/app/Console/Commands/calculatemarkettax.php',
|
||||
'App\\Console\\Commands\\CorpJournal' => $baseDir . '/app/Console/Commands/corpJournal.php',
|
||||
'App\\Console\\Commands\\DumpFleets' => $baseDir . '/app/Console/Commands/dumpFleets.php',
|
||||
@@ -45,16 +46,15 @@ return array(
|
||||
'App\\Http\\Middleware\\TrimStrings' => $baseDir . '/app/Http/Middleware/TrimStrings.php',
|
||||
'App\\Http\\Middleware\\TrustProxies' => $baseDir . '/app/Http/Middleware/TrustProxies.php',
|
||||
'App\\Http\\Middleware\\VerifyCsrfToken' => $baseDir . '/app/Http/Middleware/VerifyCsrfToken.php',
|
||||
'App\\Library\\Esi' => $baseDir . '/app/Library/Esi.php',
|
||||
'App\\Library\\Esi\\Esi' => $baseDir . '/app/Library/Esi/Esi.php',
|
||||
'App\\Library\\Esi\\Mail' => $baseDir . '/app/Library/Esi/Mail.php',
|
||||
'App\\Library\\FinanceHelper' => $baseDir . '/app/Library/FinanceHelper.php',
|
||||
'App\\Library\\Finances\\FinanceHelper' => $baseDir . '/app/Library/Finances/FinanceHelper.php',
|
||||
'App\\Library\\FleetHelper' => $baseDir . '/app/Library/FleetHelper.php',
|
||||
'App\\Library\\Finances\\Helper\\FinanceHelper' => $baseDir . '/app/Library/Finances/Helper/FinanceHelper.php',
|
||||
'App\\Library\\Finances\\JumpBridgeTax' => $baseDir . '/app/Library/Finances/JumpBridgeTax.php',
|
||||
'App\\Library\\Finances\\MarketTax' => $baseDir . '/app/Library/Finances/MarketTax.php',
|
||||
'App\\Library\\Finances\\PlayerDonation' => $baseDir . '/app/Library/Finances/PlayerDonation.php',
|
||||
'App\\Library\\Finances\\ReprocessingTax' => $baseDir . '/app/Library/Finances/ReprocessingTax.php',
|
||||
'App\\Library\\Fleets\\FleetHelper' => $baseDir . '/app/Library/Fleets/FleetHelper.php',
|
||||
'App\\Library\\Mail' => $baseDir . '/app/Library/Mail.php',
|
||||
'App\\Library\\MoonCalc' => $baseDir . '/app/Library/MoonCalc.php',
|
||||
'App\\Library\\MoonMine' => $baseDir . '/app/Library/MoonMine.php',
|
||||
'App\\Library\\Lookups\\LookupHelper' => $baseDir . '/app/Library/Lookups/LookupHelper.php',
|
||||
'App\\Library\\Moons\\MoonCalc' => $baseDir . '/app/Library/Moons/MoonCalc.php',
|
||||
'App\\Library\\Moons\\MoonMine' => $baseDir . '/app/Library/Moons/MoonMine.php',
|
||||
'App\\Library\\SeatHelper' => $baseDir . '/app/Library/SeatHelper.php',
|
||||
@@ -70,7 +70,10 @@ return array(
|
||||
'App\\Models\\Doku\\DokuUser' => $baseDir . '/app/Models/Doku/DokuUser.php',
|
||||
'App\\Models\\Esi\\EsiScope' => $baseDir . '/app/Models/Esi/EsiScope.php',
|
||||
'App\\Models\\Esi\\EsiToken' => $baseDir . '/app/Models/Esi/EsiToken.php',
|
||||
'App\\Models\\Finances\\CorpMarketJournal' => $baseDir . '/app/Models/Finances/CorpMarketJournal.php',
|
||||
'App\\Models\\Finances\\JumpBridgeJournal' => $baseDir . '/app/Models/Finances/JumpBridgeJournal.php',
|
||||
'App\\Models\\Finances\\PlayerDonationJournal' => $baseDir . '/app/Models/Finances/PlayerDonationJournal.php',
|
||||
'App\\Models\\Finances\\ReprocessingTaxJournal' => $baseDir . '/app/Models/Finances/ReprocessingTaxJournal.php',
|
||||
'App\\Models\\Fleet\\Fleet' => $baseDir . '/app/Models/Fleet/Fleet.php',
|
||||
'App\\Models\\Fleet\\FleetActivity' => $baseDir . '/app/Models/Fleet/FleetActivity.php',
|
||||
'App\\Models\\Logistics\\Contract' => $baseDir . '/app/Models/Logistics/Contract.php',
|
||||
@@ -667,6 +670,8 @@ return array(
|
||||
'Faker\\ValidGenerator' => $vendorDir . '/fzaninotto/faker/src/Faker/ValidGenerator.php',
|
||||
'Fideloper\\Proxy\\TrustProxies' => $vendorDir . '/fideloper/proxy/src/TrustProxies.php',
|
||||
'Fideloper\\Proxy\\TrustedProxyServiceProvider' => $vendorDir . '/fideloper/proxy/src/TrustedProxyServiceProvider.php',
|
||||
'Fx3costa\\LaravelChartJs\\Builder' => $vendorDir . '/fx3costa/laravelchartjs/src/Builder.php',
|
||||
'Fx3costa\\LaravelChartJs\\Providers\\ChartjsServiceProvider' => $vendorDir . '/fx3costa/laravelchartjs/src/Providers/ChartjsServiceProvider.php',
|
||||
'GuzzleHttp\\Client' => $vendorDir . '/guzzlehttp/guzzle/src/Client.php',
|
||||
'GuzzleHttp\\ClientInterface' => $vendorDir . '/guzzlehttp/guzzle/src/ClientInterface.php',
|
||||
'GuzzleHttp\\Cookie\\CookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php',
|
||||
|
||||
1
vendor/composer/autoload_psr4.php
vendored
1
vendor/composer/autoload_psr4.php
vendored
@@ -57,6 +57,7 @@ return array(
|
||||
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
|
||||
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
|
||||
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
|
||||
'Fx3costa\\LaravelChartJs\\' => array($vendorDir . '/fx3costa/laravelchartjs/src'),
|
||||
'Fideloper\\Proxy\\' => array($vendorDir . '/fideloper/proxy/src'),
|
||||
'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'),
|
||||
'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/EmailValidator'),
|
||||
|
||||
24
vendor/composer/autoload_static.php
vendored
24
vendor/composer/autoload_static.php
vendored
@@ -139,6 +139,7 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
),
|
||||
'F' =>
|
||||
array (
|
||||
'Fx3costa\\LaravelChartJs\\' => 24,
|
||||
'Fideloper\\Proxy\\' => 16,
|
||||
'Faker\\' => 6,
|
||||
),
|
||||
@@ -376,6 +377,10 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
|
||||
),
|
||||
'Fx3costa\\LaravelChartJs\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/fx3costa/laravelchartjs/src',
|
||||
),
|
||||
'Fideloper\\Proxy\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/fideloper/proxy/src',
|
||||
@@ -455,6 +460,7 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'App\\CharacterToCorporation' => __DIR__ . '/../..' . '/app/Models/Charcter/CharacterToCorporation.php',
|
||||
'App\\Console\\Commands\\CalculateMarketTax' => __DIR__ . '/../..' . '/app/Console/Commands/calculatemarkettax.php',
|
||||
'App\\Console\\Commands\\CorpJournal' => __DIR__ . '/../..' . '/app/Console/Commands/corpJournal.php',
|
||||
'App\\Console\\Commands\\DumpFleets' => __DIR__ . '/../..' . '/app/Console/Commands/dumpFleets.php',
|
||||
@@ -494,16 +500,15 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
'App\\Http\\Middleware\\TrimStrings' => __DIR__ . '/../..' . '/app/Http/Middleware/TrimStrings.php',
|
||||
'App\\Http\\Middleware\\TrustProxies' => __DIR__ . '/../..' . '/app/Http/Middleware/TrustProxies.php',
|
||||
'App\\Http\\Middleware\\VerifyCsrfToken' => __DIR__ . '/../..' . '/app/Http/Middleware/VerifyCsrfToken.php',
|
||||
'App\\Library\\Esi' => __DIR__ . '/../..' . '/app/Library/Esi.php',
|
||||
'App\\Library\\Esi\\Esi' => __DIR__ . '/../..' . '/app/Library/Esi/Esi.php',
|
||||
'App\\Library\\Esi\\Mail' => __DIR__ . '/../..' . '/app/Library/Esi/Mail.php',
|
||||
'App\\Library\\FinanceHelper' => __DIR__ . '/../..' . '/app/Library/FinanceHelper.php',
|
||||
'App\\Library\\Finances\\FinanceHelper' => __DIR__ . '/../..' . '/app/Library/Finances/FinanceHelper.php',
|
||||
'App\\Library\\FleetHelper' => __DIR__ . '/../..' . '/app/Library/FleetHelper.php',
|
||||
'App\\Library\\Finances\\Helper\\FinanceHelper' => __DIR__ . '/../..' . '/app/Library/Finances/Helper/FinanceHelper.php',
|
||||
'App\\Library\\Finances\\JumpBridgeTax' => __DIR__ . '/../..' . '/app/Library/Finances/JumpBridgeTax.php',
|
||||
'App\\Library\\Finances\\MarketTax' => __DIR__ . '/../..' . '/app/Library/Finances/MarketTax.php',
|
||||
'App\\Library\\Finances\\PlayerDonation' => __DIR__ . '/../..' . '/app/Library/Finances/PlayerDonation.php',
|
||||
'App\\Library\\Finances\\ReprocessingTax' => __DIR__ . '/../..' . '/app/Library/Finances/ReprocessingTax.php',
|
||||
'App\\Library\\Fleets\\FleetHelper' => __DIR__ . '/../..' . '/app/Library/Fleets/FleetHelper.php',
|
||||
'App\\Library\\Mail' => __DIR__ . '/../..' . '/app/Library/Mail.php',
|
||||
'App\\Library\\MoonCalc' => __DIR__ . '/../..' . '/app/Library/MoonCalc.php',
|
||||
'App\\Library\\MoonMine' => __DIR__ . '/../..' . '/app/Library/MoonMine.php',
|
||||
'App\\Library\\Lookups\\LookupHelper' => __DIR__ . '/../..' . '/app/Library/Lookups/LookupHelper.php',
|
||||
'App\\Library\\Moons\\MoonCalc' => __DIR__ . '/../..' . '/app/Library/Moons/MoonCalc.php',
|
||||
'App\\Library\\Moons\\MoonMine' => __DIR__ . '/../..' . '/app/Library/Moons/MoonMine.php',
|
||||
'App\\Library\\SeatHelper' => __DIR__ . '/../..' . '/app/Library/SeatHelper.php',
|
||||
@@ -519,7 +524,10 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
'App\\Models\\Doku\\DokuUser' => __DIR__ . '/../..' . '/app/Models/Doku/DokuUser.php',
|
||||
'App\\Models\\Esi\\EsiScope' => __DIR__ . '/../..' . '/app/Models/Esi/EsiScope.php',
|
||||
'App\\Models\\Esi\\EsiToken' => __DIR__ . '/../..' . '/app/Models/Esi/EsiToken.php',
|
||||
'App\\Models\\Finances\\CorpMarketJournal' => __DIR__ . '/../..' . '/app/Models/Finances/CorpMarketJournal.php',
|
||||
'App\\Models\\Finances\\JumpBridgeJournal' => __DIR__ . '/../..' . '/app/Models/Finances/JumpBridgeJournal.php',
|
||||
'App\\Models\\Finances\\PlayerDonationJournal' => __DIR__ . '/../..' . '/app/Models/Finances/PlayerDonationJournal.php',
|
||||
'App\\Models\\Finances\\ReprocessingTaxJournal' => __DIR__ . '/../..' . '/app/Models/Finances/ReprocessingTaxJournal.php',
|
||||
'App\\Models\\Fleet\\Fleet' => __DIR__ . '/../..' . '/app/Models/Fleet/Fleet.php',
|
||||
'App\\Models\\Fleet\\FleetActivity' => __DIR__ . '/../..' . '/app/Models/Fleet/FleetActivity.php',
|
||||
'App\\Models\\Logistics\\Contract' => __DIR__ . '/../..' . '/app/Models/Logistics/Contract.php',
|
||||
@@ -1116,6 +1124,8 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
'Faker\\ValidGenerator' => __DIR__ . '/..' . '/fzaninotto/faker/src/Faker/ValidGenerator.php',
|
||||
'Fideloper\\Proxy\\TrustProxies' => __DIR__ . '/..' . '/fideloper/proxy/src/TrustProxies.php',
|
||||
'Fideloper\\Proxy\\TrustedProxyServiceProvider' => __DIR__ . '/..' . '/fideloper/proxy/src/TrustedProxyServiceProvider.php',
|
||||
'Fx3costa\\LaravelChartJs\\Builder' => __DIR__ . '/..' . '/fx3costa/laravelchartjs/src/Builder.php',
|
||||
'Fx3costa\\LaravelChartJs\\Providers\\ChartjsServiceProvider' => __DIR__ . '/..' . '/fx3costa/laravelchartjs/src/Providers/ChartjsServiceProvider.php',
|
||||
'GuzzleHttp\\Client' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Client.php',
|
||||
'GuzzleHttp\\ClientInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/ClientInterface.php',
|
||||
'GuzzleHttp\\Cookie\\CookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php',
|
||||
|
||||
54
vendor/composer/installed.json
vendored
54
vendor/composer/installed.json
vendored
@@ -608,6 +608,60 @@
|
||||
"whoops"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fx3costa/laravelchartjs",
|
||||
"version": "2.5.1",
|
||||
"version_normalized": "2.5.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fxcosta/laravel-chartjs.git",
|
||||
"reference": "ab1b987e12c477be2408f77df8c0506be0e7848b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fxcosta/laravel-chartjs/zipball/ab1b987e12c477be2408f77df8c0506be0e7848b",
|
||||
"reference": "ab1b987e12c477be2408f77df8c0506be0e7848b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "~5.1",
|
||||
"php": ">=5.6.4"
|
||||
},
|
||||
"time": "2018-09-11T21:37:47+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Fx3costa\\LaravelChartJs\\Providers\\ChartjsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Fx3costa\\LaravelChartJs\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Felix",
|
||||
"email": "fx3costa@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library",
|
||||
"keywords": [
|
||||
"chart",
|
||||
"chartjs",
|
||||
"fx3costa",
|
||||
"graphics",
|
||||
"laravel5",
|
||||
"reports"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fzaninotto/faker",
|
||||
"version": "v1.8.0",
|
||||
|
||||
219
vendor/fx3costa/laravelchartjs/README.md
vendored
Normal file
219
vendor/fx3costa/laravelchartjs/README.md
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
|
||||
# laravel-chartjs - Chart.js v2 wrapper for Laravel 5.x
|
||||
|
||||
Simple package to facilitate and automate the use of charts in Laravel 5.x
|
||||
using the [Chart.js](http://www.chartjs.org/) v2 library from Nick Downie.
|
||||
|
||||
# Setup:
|
||||
```
|
||||
composer require fx3costa/laravelchartjs
|
||||
```
|
||||
|
||||
And add the Service Provider in your file config/app.php:
|
||||
```php
|
||||
Fx3costa\LaravelChartJs\Providers\ChartjsServiceProvider::class
|
||||
```
|
||||
|
||||
Finaly, for now, you must install and add to your layouts / templates the Chartjs library that can be easily
|
||||
found for download at: http://www.chartjs.org. This setting will also be improved.
|
||||
|
||||
# Usage:
|
||||
|
||||
You can request to Service Container the service responsible for building the charts
|
||||
and passing through fluent interface the chart settings.
|
||||
|
||||
```php
|
||||
$service = app()->chartjs
|
||||
->name()
|
||||
->type()
|
||||
->size()
|
||||
->labels()
|
||||
->datasets()
|
||||
->options();
|
||||
```
|
||||
|
||||
For now the builder needs the name of the chart, the type of chart that can be anything that is supported by chartjs and the other custom configurations like labels, datasets, size and options.
|
||||
|
||||
In the dataset interface you can pass any configuration and option to your chart.
|
||||
All options available in chartjs documentation are supported.
|
||||
Just write the configuration with php array notations and its work!
|
||||
|
||||
# Advanced chartjs options
|
||||
|
||||
Since the current version allows it to add simple json string based options, it is not possible to generate options like:
|
||||
|
||||
```php
|
||||
options: {
|
||||
scales: {
|
||||
xAxes: [{
|
||||
type: 'time',
|
||||
time: {
|
||||
displayFormats: {
|
||||
quarter: 'MMM YYYY'
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Using the method optionsRaw(string) its possible to add a the options in raw format:
|
||||
|
||||
Passing string format like a json
|
||||
```php
|
||||
$chart->optionsRaw("{
|
||||
legend: {
|
||||
display:false
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
gridLines: {
|
||||
display:false
|
||||
}
|
||||
}]
|
||||
}
|
||||
}");
|
||||
```
|
||||
|
||||
Or, if your prefer, you can pass a php array format
|
||||
|
||||
```php
|
||||
$chart->optionsRaw([
|
||||
'legend' => [
|
||||
'display' => true,
|
||||
'labels' => [
|
||||
'fontColor' => '#000'
|
||||
]
|
||||
],
|
||||
'scales' => [
|
||||
'xAxes' => [
|
||||
[
|
||||
'stacked' => true,
|
||||
'gridLines' => [
|
||||
'display' => true
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
```
|
||||
|
||||
|
||||
# Examples
|
||||
|
||||
1 - Line Chart / Radar Chart:
|
||||
```php
|
||||
// ExampleController.php
|
||||
|
||||
$chartjs = app()->chartjs
|
||||
->name('lineChartTest')
|
||||
->type('line')
|
||||
->size(['width' => 400, 'height' => 200])
|
||||
->labels(['January', 'February', 'March', 'April', 'May', 'June', 'July'])
|
||||
->datasets([
|
||||
[
|
||||
"label" => "My First dataset",
|
||||
'backgroundColor' => "rgba(38, 185, 154, 0.31)",
|
||||
'borderColor' => "rgba(38, 185, 154, 0.7)",
|
||||
"pointBorderColor" => "rgba(38, 185, 154, 0.7)",
|
||||
"pointBackgroundColor" => "rgba(38, 185, 154, 0.7)",
|
||||
"pointHoverBackgroundColor" => "#fff",
|
||||
"pointHoverBorderColor" => "rgba(220,220,220,1)",
|
||||
'data' => [65, 59, 80, 81, 56, 55, 40],
|
||||
],
|
||||
[
|
||||
"label" => "My Second dataset",
|
||||
'backgroundColor' => "rgba(38, 185, 154, 0.31)",
|
||||
'borderColor' => "rgba(38, 185, 154, 0.7)",
|
||||
"pointBorderColor" => "rgba(38, 185, 154, 0.7)",
|
||||
"pointBackgroundColor" => "rgba(38, 185, 154, 0.7)",
|
||||
"pointHoverBackgroundColor" => "#fff",
|
||||
"pointHoverBorderColor" => "rgba(220,220,220,1)",
|
||||
'data' => [12, 33, 44, 44, 55, 23, 40],
|
||||
]
|
||||
])
|
||||
->options([]);
|
||||
|
||||
return view('example', compact('chartjs'));
|
||||
|
||||
|
||||
// example.blade.php
|
||||
|
||||
<div style="width:75%;">
|
||||
{!! $chartjs->render() !!}
|
||||
</div>
|
||||
```
|
||||
|
||||
|
||||
2 - Bar Chart:
|
||||
```php
|
||||
// ExampleController.php
|
||||
|
||||
$chartjs = app()->chartjs
|
||||
->name('barChartTest')
|
||||
->type('bar')
|
||||
->size(['width' => 400, 'height' => 200])
|
||||
->labels(['Label x', 'Label y'])
|
||||
->datasets([
|
||||
[
|
||||
"label" => "My First dataset",
|
||||
'backgroundColor' => ['rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)'],
|
||||
'data' => [69, 59]
|
||||
],
|
||||
[
|
||||
"label" => "My First dataset",
|
||||
'backgroundColor' => ['rgba(255, 99, 132, 0.3)', 'rgba(54, 162, 235, 0.3)'],
|
||||
'data' => [65, 12]
|
||||
]
|
||||
])
|
||||
->options([]);
|
||||
|
||||
return view('example', compact('chartjs'));
|
||||
|
||||
|
||||
// example.blade.php
|
||||
|
||||
<div style="width:75%;">
|
||||
{!! $chartjs->render() !!}
|
||||
</div>
|
||||
```
|
||||
|
||||
|
||||
3 - Pie Chart / Doughnut Chart:
|
||||
```php
|
||||
// ExampleController.php
|
||||
|
||||
$chartjs = app()->chartjs
|
||||
->name('pieChartTest')
|
||||
->type('pie')
|
||||
->size(['width' => 400, 'height' => 200])
|
||||
->labels(['Label x', 'Label y'])
|
||||
->datasets([
|
||||
[
|
||||
'backgroundColor' => ['#FF6384', '#36A2EB'],
|
||||
'hoverBackgroundColor' => ['#FF6384', '#36A2EB'],
|
||||
'data' => [69, 59]
|
||||
]
|
||||
])
|
||||
->options([]);
|
||||
|
||||
return view('example', compact('chartjs'));
|
||||
|
||||
|
||||
// example.blade.php
|
||||
|
||||
<div style="width:75%;">
|
||||
{!! $chartjs->render() !!}
|
||||
</div>
|
||||
```
|
||||
|
||||
|
||||
# OBS:
|
||||
|
||||
This README as well as the package is in development but will be constantly updated and will keep you informed as soon as
|
||||
are ready for production. Thank you for understanding.
|
||||
|
||||
Any questions or suggestions preferably open a issue!
|
||||
|
||||
# License
|
||||
LaravelChartJs is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
|
||||
32
vendor/fx3costa/laravelchartjs/composer.json
vendored
Normal file
32
vendor/fx3costa/laravelchartjs/composer.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "fx3costa/laravelchartjs",
|
||||
"description": "Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library",
|
||||
"keywords": [
|
||||
"chartjs","laravel5","chart","reports","graphics", "fx3costa"
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Felix",
|
||||
"email": "fx3costa@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6.4",
|
||||
"illuminate/support": "~5.1"
|
||||
},
|
||||
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Fx3costa\\LaravelChartJs\\" : "src/"
|
||||
}
|
||||
},
|
||||
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Fx3costa\\LaravelChartJs\\Providers\\ChartjsServiceProvider"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
180
vendor/fx3costa/laravelchartjs/src/Builder.php
vendored
Normal file
180
vendor/fx3costa/laravelchartjs/src/Builder.php
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is inspired by Builder from Laravel ChartJS - Brian Faust
|
||||
*/
|
||||
|
||||
namespace Fx3costa\LaravelChartJs;
|
||||
|
||||
class Builder
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $charts = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $defaults = [
|
||||
'datasets' => [],
|
||||
'labels' => [],
|
||||
'type' => 'line',
|
||||
'options' => [],
|
||||
'size' => ['width' => null, 'height' => null]
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $types = [
|
||||
'bar',
|
||||
'horizontalBar',
|
||||
'bubble',
|
||||
'scatter',
|
||||
'doughnut',
|
||||
'line',
|
||||
'pie',
|
||||
'polarArea',
|
||||
'radar'
|
||||
];
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return $this|Builder
|
||||
*/
|
||||
public function name($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->charts[$name] = $this->defaults;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $element
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function element($element)
|
||||
{
|
||||
return $this->set('element', $element);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $labels
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function labels(array $labels)
|
||||
{
|
||||
return $this->set('labels', $labels);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $datasets
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function datasets(array $datasets)
|
||||
{
|
||||
return $this->set('datasets', $datasets);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function type($type)
|
||||
{
|
||||
if (!in_array($type, $this->types)) {
|
||||
throw new \InvalidArgumentException('Invalid Chart type.');
|
||||
}
|
||||
return $this->set('type', $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $size
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function size($size)
|
||||
{
|
||||
return $this->set('size', $size);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
*
|
||||
* @return $this|Builder
|
||||
*/
|
||||
public function options(array $options)
|
||||
{
|
||||
foreach ($options as $key => $value) {
|
||||
$this->set('options.' . $key, $value);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|array $optionsRaw
|
||||
* @return \self
|
||||
*/
|
||||
public function optionsRaw($optionsRaw)
|
||||
{
|
||||
if (is_array($optionsRaw)) {
|
||||
$this->set('optionsRaw', json_encode($optionsRaw, true));
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->set('optionsRaw', $optionsRaw);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$chart = $this->charts[$this->name];
|
||||
|
||||
return view('chart-template::chart-template')
|
||||
->with('datasets', $chart['datasets'])
|
||||
->with('element', $this->name)
|
||||
->with('labels', $chart['labels'])
|
||||
->with('options', isset($chart['options']) ? $chart['options'] : '')
|
||||
->with('optionsRaw', isset($chart['optionsRaw']) ? $chart['optionsRaw'] : '')
|
||||
->with('type', $chart['type'])
|
||||
->with('size', $chart['size']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function get($key)
|
||||
{
|
||||
return array_get($this->charts[$this->name], $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $value
|
||||
*
|
||||
* @return $this|Builder
|
||||
*/
|
||||
private function set($key, $value)
|
||||
{
|
||||
array_set($this->charts[$this->name], $key, $value);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
37
vendor/fx3costa/laravelchartjs/src/Providers/ChartjsServiceProvider.php
vendored
Normal file
37
vendor/fx3costa/laravelchartjs/src/Providers/ChartjsServiceProvider.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php namespace Fx3costa\LaravelChartJs\Providers;
|
||||
|
||||
use Fx3costa\LaravelChartJs\Builder;
|
||||
use Fx3costa\LaravelChartJs\ChartBar;
|
||||
use Fx3costa\LaravelChartJs\ChartLine;
|
||||
use Fx3costa\LaravelChartJs\ChartPieAndDoughnut;
|
||||
use Fx3costa\LaravelChartJs\ChartRadar;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ChartjsServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* Array with colours configuration of the chartjs config file
|
||||
* @var array
|
||||
*/
|
||||
protected $colours = [];
|
||||
|
||||
public function boot()
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__.'/../resources/views', 'chart-template');
|
||||
$this->colours = config('chartjs.colours');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind('chartjs', function() {
|
||||
return new Builder();
|
||||
});
|
||||
}
|
||||
}
|
||||
22
vendor/fx3costa/laravelchartjs/src/resources/views/chart-template.blade.php
vendored
Normal file
22
vendor/fx3costa/laravelchartjs/src/resources/views/chart-template.blade.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<canvas id="{!! $element !!}" width="{!! $size['width'] !!}" height="{!! $size['height'] !!}">
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
(function() {
|
||||
"use strict";
|
||||
let ctx = document.getElementById("{!! $element !!}");
|
||||
window.{!! $element !!} = new Chart(ctx, {
|
||||
type: '{!! $type !!}',
|
||||
data: {
|
||||
labels: {!! json_encode($labels) !!},
|
||||
datasets: {!! json_encode($datasets) !!}
|
||||
},
|
||||
@if(!empty($optionsRaw))
|
||||
options: {!! $optionsRaw !!}
|
||||
@elseif(!empty($options))
|
||||
options: {!! json_encode($options) !!}
|
||||
@endif
|
||||
});
|
||||
})();
|
||||
});
|
||||
</script>
|
||||
</canvas>
|
||||
Reference in New Issue
Block a user