mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
74 lines
1.4 KiB
PHP
74 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Models\Invoice;
|
|
use App\Ninja\Mailers\ContactMailer;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Monolog\Logger;
|
|
use Carbon;
|
|
|
|
/**
|
|
* Class SendInvoiceEmail
|
|
*/
|
|
class SendInvoiceEmail extends Job implements ShouldQueue
|
|
{
|
|
use InteractsWithQueue, SerializesModels;
|
|
|
|
/**
|
|
* @var Invoice
|
|
*/
|
|
protected $invoice;
|
|
|
|
/**
|
|
* @var bool
|
|
*/
|
|
protected $reminder;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $pdfString;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @param Invoice $invoice
|
|
* @param string $pdf
|
|
* @param bool $reminder
|
|
*/
|
|
public function __construct(Invoice $invoice, $reminder = false, $pdfString = false)
|
|
{
|
|
$this->invoice = $invoice;
|
|
$this->reminder = $reminder;
|
|
$this->pdfString = $pdfString;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @param ContactMailer $mailer
|
|
*/
|
|
public function handle(ContactMailer $mailer)
|
|
{
|
|
$mailer->sendInvoice($this->invoice, $this->reminder, $this->pdfString);
|
|
}
|
|
|
|
/**
|
|
* Handle a job failure.
|
|
*
|
|
* @param ContactMailer $mailer
|
|
* @param Logger $logger
|
|
*/
|
|
/*
|
|
public function failed(ContactMailer $mailer, Logger $logger)
|
|
{
|
|
$this->jobName = $this->job->getName();
|
|
|
|
parent::failed($mailer, $logger);
|
|
}
|
|
*/
|
|
}
|