diff --git a/app/Console/Commands/Flex/FlexStructureCommand.php b/app/Console/Commands/Flex/FlexStructureCommand.php index 3b2dd3306..cb70a00b9 100644 --- a/app/Console/Commands/Flex/FlexStructureCommand.php +++ b/app/Console/Commands/Flex/FlexStructureCommand.php @@ -15,7 +15,6 @@ use Commands\Library\CommandHelper; //Models use App\Models\Flex\FlexStructure; use App\Models\Mail\SentMail; -use App\Models\Jobs\JobSendEveMail; class FlexStructureCommand extends Command { @@ -93,19 +92,14 @@ class FlexStructureCommand extends Command $body .= "Warped Intentions Leadership
"; //Dispatch the mail job - $mail = new JobSendEveMail; - $mail->sender = $config['primary']; - $mail->subject = "Warped Intentions Flex Structures Payment Due for " . $today->englishMonth; - $mail->body = $body; - $mail->recipient = (int)$structure->requestor_id; - $mail->recipient_type = 'character'; - ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($delay)); + $subject = "Warped Intentions Flex Structures Payment Due for " . $today->englishMonth; + ProcessSendEveMailJob::dispatch($body, (int)$structure->requestor_id, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($delay)); //Increment the delay for the mail to not hit the rate limits $delay += 60; //After the mail is dispatched, save the sent mail record - $this->SaveSentRecord($mail->sender, $mail->subject, $mail->body, $mail->recipient, $mail->recipient_type); + $this->SaveSentRecord($config['primary'], $subject, $body, (int)$structure->requestor_id, 'character'); } //Mark the job as finished diff --git a/app/Console/Commands/Moons/MoonMailer.php b/app/Console/Commands/Moons/MoonMailer.php index e01a8c951..98682a9a4 100644 --- a/app/Console/Commands/Moons/MoonMailer.php +++ b/app/Console/Commands/Moons/MoonMailer.php @@ -17,7 +17,6 @@ use Seat\Eseye\Exceptions\RequestFailedException; //Models use App\Models\Moon\RentalMoon; use App\Models\MoonRent\MoonRental; -use App\Models\Jobs\JobSendEveMail; use App\Models\Mail\SentMail; class MoonMailerCommand extends Command @@ -101,13 +100,8 @@ class MoonMailerCommand extends Command $body .= "Warped Intentions Leadership
"; //Dispatch the mail job - $mail = new JobSendEveMail; - $mail->sender = $config['primary']; - $mail->subject = "Warped Intentions Moon Rental Payment Due for " . $today->englishMonth; - $mail->body = $body; - $mail->recipient = (int)$contact->Contact; - $mail->recipient_type = 'character'; - ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($delay)); + $subject = "Warped Intentions Moon Rental Payment Due for " . $today->englishMonth; + ProcessSendEveMailJob::dispatch($body, (int)$contact->Contact, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($delay)); //Increment the delay for the mail to not hit rate limits $delay += 30; diff --git a/app/Http/Controllers/Contracts/ContractAdminController.php b/app/Http/Controllers/Contracts/ContractAdminController.php index 4a210e4b3..f57a45990 100644 --- a/app/Http/Controllers/Contracts/ContractAdminController.php +++ b/app/Http/Controllers/Contracts/ContractAdminController.php @@ -18,7 +18,6 @@ use App\Models\User\UserPermission; use App\Models\Contracts\Contract; use App\Models\Contracts\Bid; use App\Models\Contracts\AcceptedBid; -use App\Models\Jobs\JobSendEveMail; class ContractAdminController extends Controller { @@ -152,15 +151,8 @@ class ContractAdminController extends Controller $body .= 'Please remit contract when the items are ready to Spatial Forces. Description should be the contract identification number. Request ISK should be the bid amount.'; $body .= 'Sincerely,
Spatial Forces Contracting Department'; - //Setup the mail job - $mail = new JobSendEveMail; - $mail->subject = $subject; - $mail->recipient_type = 'character'; - $mail->recipient = $bid['character_id']; - $mail->body = $body; - $mail->sender = $config['primary']; //Dispatch the mail job - ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds(5)); + ProcessSendEveMailJob::dispatch($body, $bid['character_id'], 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5)); //Tidy up the contract by doing a few things. $this->TidyContract($contract, $bid); @@ -187,12 +179,8 @@ class ContractAdminController extends Controller //Get the esi config $config = config('esi'); - $mail = new JobSendEveMail; - $mail->sender = $config['primary']; - $mail->subject = 'New Alliance Production Contract Available'; - $mail->recipient = $config['alliance']; - $mail->recipient_type = 'alliance'; - $mail->body = "A new contract is available for the alliance contracting system. Please check out Services Site if you want to bid on the production contract.

Sincerely,
Warped Intentions Leadership"; - ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds(5)); + $subject = 'New Alliance Production Contract Available'; + $body = "A new contract is available for the alliance contracting system. Please check out Services Site if you want to bid on the production contract.

Sincerely,
Warped Intentions Leadership"; + ProcessSendEveMailJob::dispatch($body, $config['alliance'], 'alliance', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5)); } } diff --git a/app/Http/Controllers/Logistics/StructureRequestAdminController.php b/app/Http/Controllers/Logistics/StructureRequestAdminController.php index f23966e0b..6f9381921 100644 --- a/app/Http/Controllers/Logistics/StructureRequestAdminController.php +++ b/app/Http/Controllers/Logistics/StructureRequestAdminController.php @@ -9,7 +9,6 @@ use Log; //Models use App\Models\Logistics\AnchorStructure; -use App\Models\Jobs\JobSendEveMail; class StructureRequestAdminController extends Controller { diff --git a/app/Http/Controllers/Logistics/StructureRequestController.php b/app/Http/Controllers/Logistics/StructureRequestController.php index cdb3efad7..615c14d86 100644 --- a/app/Http/Controllers/Logistics/StructureRequestController.php +++ b/app/Http/Controllers/Logistics/StructureRequestController.php @@ -15,7 +15,6 @@ use App\Library\Lookups\LookupHelper; //Models use App\Models\Logistics\AnchorStructure; -use App\Models\Jobs\JobSendEveMail; use App\Models\User\UserPermission; class StructureRequestController extends Controller @@ -72,13 +71,8 @@ class StructureRequestController extends Controller $body .= "Warped Intentions Leadership
"; //Dispatch the mail job - $mail = new JobSendEveMail; - $mail->sender = $config['primary']; - $mail->subject = "New Structure Anchor Request"; - $mail->body = $body; - $mail->recipient = (int)$fc->character_id; - $mail->recipient_type = 'character'; - ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($delay)); + $subject = "New Structure Anchor Request"; + ProcessSendEveMailJob::dispatch($body, (int)$fc->character_id, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($delay)); $delay += 15; } diff --git a/app/Http/Controllers/Moons/MoonsAdminController.php b/app/Http/Controllers/Moons/MoonsAdminController.php index 73ef7f152..a187774ad 100644 --- a/app/Http/Controllers/Moons/MoonsAdminController.php +++ b/app/Http/Controllers/Moons/MoonsAdminController.php @@ -17,7 +17,6 @@ use App\Models\Moon\Price; use App\Models\MoonRent\MoonRental; use App\Models\Moon\AllianceMoon; use App\Models\Moon\AllianceMoonRequest; -use App\Models\Jobs\JobSendEveMail; //Library use App\Library\Moons\MoonCalc; @@ -130,13 +129,7 @@ class MoonsAdminController extends Controller } //Setup the mail model - $mail = new JobSendEveMail; - $mail->sender = $config['primary']; - $mail->subject = 'Warped Intentions Moon Request'; - $mail->body = $body; - $mail->recipient = (int)$moon->requestor_id; - $mail->recipient_type = 'character'; - ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds(5)); + ProcessSendEveMailJob::dispatch($body, (int)$moon->requestor_id, 'character', 'Warped Intentions Moon Request', $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5)); return redirect('/moons/admin/display/request')->with('success', 'Moon has been processed, and mail has been sent out.'); } diff --git a/app/Jobs/Commands/Moons/MoonRentalInvoiceCreate.php b/app/Jobs/Commands/Moons/MoonRentalInvoiceCreate.php index afd447e94..9104ae246 100644 --- a/app/Jobs/Commands/Moons/MoonRentalInvoiceCreate.php +++ b/app/Jobs/Commands/Moons/MoonRentalInvoiceCreate.php @@ -21,7 +21,6 @@ use Seat\Eseye\Exceptions\RequestFailedException; //Models use App\Models\Moon\RentalMoon; use App\Models\MoonRent\MoonRental; -use App\Models\Jobs\JobSendEveMail; use App\Models\Mail\SentMail; class MoonRentalInvoiceCreate implements ShouldQueue @@ -117,13 +116,8 @@ class MoonRentalInvoiceCreate implements ShouldQueue //Dispatch a new mail job - $mail = new JobSendEveMail; - $mail->sender = $config['primary']; - $mail->subject = "Warped Intentions Moon Rental Payment Due for " . $today->englishMonth; - $mail->body = $body; - $mail->recipient = (int)$contact->Contact; - $mail->recipient_type = 'character'; - ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($this->delay)); + $subject = "Warped Intentions Moon Rental Payment Due for " . $today->englishMonth; + ProcessSendEveMailJob::dispatch($body, (int)$contact->Contact, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($this->delay)); MoonRentalUpdate::dispatch($this->rentals)->onQueue('moons'); } diff --git a/app/Jobs/ProcessSendEveMailJob.php b/app/Jobs/ProcessSendEveMailJob.php index f96b780ed..b6f246791 100644 --- a/app/Jobs/ProcessSendEveMailJob.php +++ b/app/Jobs/ProcessSendEveMailJob.php @@ -22,7 +22,6 @@ use App\Models\Esi\EsiScope; use App\Models\Esi\EsiToken; use App\Models\Jobs\JobStatus; use App\Models\Mail\SentMail; -use App\Models\Jobs\JobSendEveMail; class ProcessSendEveMailJob implements ShouldQueue { @@ -53,12 +52,12 @@ class ProcessSendEveMailJob implements ShouldQueue * * @return void */ - public function __construct(JobSendEveMail $mail) { - $this->body = $mail->body; - $this->recipient = $mail->recipient; - $this->recipient_type = $mail->recipient_type; - $this->subject = $mail->subject; - $this->sender = $mail->sender; + public function __construct($body, $recipient, $recipient_type, $subject, $sender) { + $this->body = $body; + $this->recipient = $recipient; + $this->recipient_type = $recipient_type; + $this->subject = $subject; + $this->sender = $sender; $this->connection = 'redis'; } diff --git a/app/Library/Esi/Esi.php b/app/Library/Esi/Esi.php index a2e8dfe1f..1ff4483e0 100644 --- a/app/Library/Esi/Esi.php +++ b/app/Library/Esi/Esi.php @@ -8,7 +8,6 @@ use Carbon\Carbon; //Models use App\Models\Esi\EsiToken; use App\Models\Esi\EsiScope; -use App\Models\Jobs\JobSendEveMail; //Jobs use App\Jobs\ProcessSendEveMailJob; @@ -41,14 +40,10 @@ class Esi { $check = EsiScope::where(['character_id' => $charId, 'scope' => $scope])->count(); if($check == 0) { //Compose a mail to send to the user if the scope is not found - $mail = new JobSendEveMail; - $mail->sender = $config['primary']; - $mail->subject = 'W4RP Services - Incorrect ESI Scope'; - $mail->body = "Please register on https://services.w4rp.space with the scope: " . $scope; - $mail->recipient = (int)$charId; - $mail->recipient_type = 'character'; + $subject = 'W4RP Services - Incorrect ESI Scope'; + $body = "Please register on https://services.w4rp.space with the scope: " . $scope; - ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds(5)); + ProcessSendEveMailJob::dispatch($body, (int)$charId, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5)); return false; } diff --git a/app/Library/Mail/Helper/EveMailHelper.php b/app/Library/Mail/Helper/EveMailHelper.php index b910b92a4..88503286f 100644 --- a/app/Library/Mail/Helper/EveMailHelper.php +++ b/app/Library/Mail/Helper/EveMailHelper.php @@ -16,7 +16,6 @@ use App\Jobs\ProcessSendEveMailJob; //Models use App\Models\Esi\EsiToken; use App\Models\Esi\EsiScope; -use App\Models\Jobs\JobSendEveMail; //Library use App\Library\Esi\Esi; diff --git a/app/Models/Jobs/JobSendEveMail.php b/app/Models/Jobs/JobSendEveMail.php deleted file mode 100644 index 7d648c54a..000000000 --- a/app/Models/Jobs/JobSendEveMail.php +++ /dev/null @@ -1,19 +0,0 @@ -