52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Models\Invoice;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class InvoiceNotificationMail extends Mailable implements ShouldQueue
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public function __construct(
|
|
public readonly Invoice $invoice,
|
|
public readonly Collection $attachments,
|
|
public readonly string $customerName,
|
|
public readonly string $message,
|
|
public readonly string $companyName,
|
|
) {}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
return new Envelope(
|
|
subject: "Thông báo hóa đơn #{$this->invoice->order_num} - {$this->companyName}",
|
|
);
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
view: 'emails.invoice-notification',
|
|
with: [
|
|
'invoice' => $this->invoice,
|
|
'attachments' => $this->attachments,
|
|
'customerName' => $this->customerName,
|
|
'message' => $this->message,
|
|
'companyName' => $this->companyName,
|
|
]
|
|
);
|
|
}
|
|
|
|
public function attachments(): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|