GetCharacterInfo($config['primary']); return view('test.char.display')->with('char', $char); } public function DebugMiningTaxesInvoices() { $lookup = new LookupHelper; $ledgers = new Collection; $perms = new Collection; var_dump(auth()->user()->getAlts()); dd(auth()->user()->altCount()); //Get all of the users in the database $users = User::all(); //Get a list of the alts for each character, then process the ledgers and combine them to send one mail out //in this first part foreach($users as $char) { $altCount = $char->altCount(); if($altCount > 0) { $alts = $char->getAlts(); foreach($alts as $alt) { $perms->push([ 'main_id' => $char->character_id, 'alt_id' => $alt->character_id, 'count' => $altCount, ]); } } else { $perms->push([ 'main_id' => $char->character_id, 'alt_id' => null, 'count' => 0, ]); } } return view('test.miningtax.invoice')->with('perms', $perms); } public function DebugMiningObservers() { //Declare variables $mailDelay = 15; //Get the users from the database $mains = User::all(); /** * For each of the users, let's determine if there are any ledgers, * then determine if there are any alts and ledgers associated with the alts. */ foreach($mains as $main) { //Declare some variables for each run through the for loop $ledgers = new Collection; $mainLedgers = new Collection; $mainLedgerCount = 0; $altLedgers = new Collection; $alts = new Collection; //Count the ledgers for the main $mainLedgerCount = Ledger::where([ 'character_id' => $main->character_id, ])->count(); //If there are ledgers for the main, then let's grab them if($mainLedgerCount > 0) { $mainLedgers = Ledger::where([ 'character_id' => $main->character_id, 'invoiced' => 'No', ])->get(); //Cycle through the entries, and add them to the ledger to send with the invoice foreach($mainLedgers as $row) { $ledgers->push([ 'character_id' => $row->character_id, 'character_name' => $row->character_name, 'type_id' => $row->type_id, 'ore_name' => $row->ore_name, 'quantity' => $row->quantity, 'amount' => $row->amount, ]); } } //Get the alt count for the main character $altCount = $main->altCount(); //If more than 0 alts, grab all the alts. if($altCount > 0) { $alts = UserAlt::where([ 'main_id' => $main->character_id, ])->get(); //Cycle through the alts, and get the ledgers, and push onto the stack foreach($alts as $alt) { $altLedgerCount = Ledger::where([ 'character_id' => 'No', 'invoiced' => 'No', ])->count(); if($altLedgerCount > 0) { $altLedgers = Ledger::where([ 'character_id' => 'No', 'invoiced' => 'No', ])->get(); foreach($altLedgers as $row) { $ledgers->push([ 'character_id' => $row->character_id, 'character_name' => $row->character_name, 'type_id' => $row->type_id, 'ore_name' => $row->ore_name, 'quantity' => $row->quantity, 'amount' => $row->amount, ]); } } } } } dd($ledgers); } }