Files
w4rpservices/app/Console/Commands/MiningTaxes/MiningTaxesInvoicesNew.php
T
2021-03-20 23:36:53 +09:00

92 lines
2.1 KiB
PHP

<?php
namespace App\Console\Commands\MiningTaxes;
//Internal Library
use Illuminate\Console\Command;
use Log;
use Carbon\Carbon;
//Application Library
use Commands\Library\CommandHelper;
use App\Library\Helpers\LookupHelper;
//Models
use App\Models\MiningTax\Invoice;
use App\Models\MiningTax\Ledger;
use App\Models\User\UserAlt;
use App\Models\User\User;
//Jobs
use App\Jobs\Commands\Eve\ProcessSendEveMailJob;
class MiningTaxesInvoicesNew extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'MiningTax:InvoiceNew';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Mining Taxes Invoice Command';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
//Declare variables
$lookup = new LookupHelper;
$config = config('esi');
$task = new CommandHelper('MiningTaxesInvoices');
$mainsAlts = array();
$mailDelay = 15;
//Set the task as started
$task->SetStartStatus();
//Get the characters for each non-invoiced ledger entry
$charIds = Ledger::where([
'invoiced' => 'No',
])->distinct('character_id')
->pluck('character_id');
//If character ids are null, then there are no ledgers to process.
if($charIds->count() == 0) {
//Set the task status as done and Log the issue
$task->SetStopStatus();
Log::warning("No characters found to send invoices to in MiningTaxesInvoices Command.");
return 0;
}
/**
* From the list of character ids, create an array of mains and alts to group together.
*/
foreach($charIds as $charId) {
}
//Set the task as stopped
$task->SetStopStatus();
return 0;
}
}