Improved handling for new invoices
This commit is contained in:
60
app/Mail/InvoiceMails/InvoiceMailsNewInvoiceMail.php
Normal file
60
app/Mail/InvoiceMails/InvoiceMailsNewInvoiceMail.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\InvoiceMails;
|
||||
|
||||
use App\Models\CostUnit;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventParticipant;
|
||||
use App\Models\Invoice;
|
||||
use App\ValueObjects\Amount;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Attachment;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
|
||||
class InvoiceMailsNewInvoiceMail extends Mailable {
|
||||
public function __construct(
|
||||
private Invoice $invoice,
|
||||
private CostUnit $costUnit,
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Neue Abrechnung in Kostenstelle ' . $this->costUnit->name,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'emails.invoices.new_invoice',
|
||||
with: [
|
||||
'costUnitName' => $this->costUnit->name,
|
||||
'invoiceAmount' => Amount::fromString($this->invoice->amount)->toString(),
|
||||
'invoiceType' => $this->invoice->invoiceType()->name,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user