osb/app/Mail/InvoiceEmail.php

56 lines
1003 B
PHP
Raw Normal View History

2020-05-25 07:45:17 +00:00
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
2020-05-25 07:45:17 +00:00
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
2020-05-25 07:45:17 +00:00
use Illuminate\Queue\SerializesModels;
use App\Models\Invoice;
class InvoiceEmail extends Mailable implements ShouldQueue
2020-05-25 07:45:17 +00:00
{
use Queueable, SerializesModels;
protected Invoice $io;
2020-05-25 07:45:17 +00:00
/**
* Create a new message instance.
*
* @param Invoice $o
*/
public function __construct(Invoice $o)
{
$this->io = $o;
$this->queue = 'user';
2020-05-25 07:45:17 +00:00
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: sprintf('Invoice %d for services, due %s',
$this->io->lid,
$this->io->due_at->format('Y-m-d')),
);
}
/**
* Get the message content definition.
2020-05-25 07:45:17 +00:00
*/
public function content(): Content
2020-05-25 07:45:17 +00:00
{
return new Content(
markdown: 'mail.invoice',
with: [
'io'=>$this->io,
'site'=>$this->io->site,
]
);
2020-05-25 07:45:17 +00:00
}
}