diff --git a/app/Console/Commands/SendInvoiceDataReport.php b/app/Console/Commands/SendInvoiceDataReport.php index da1f742..e823476 100644 --- a/app/Console/Commands/SendInvoiceDataReport.php +++ b/app/Console/Commands/SendInvoiceDataReport.php @@ -201,7 +201,9 @@ class SendInvoiceDataReport extends Command }) ->toArray(); - $mail = new InvoiceDataMail($scheduleType, $tableData); + $mailSubject = "Invoice Data Report ({$plant->name})"; + + $mail = new InvoiceDataMail($scheduleType, $tableData, $mailSubject); $contentVars = $mail->content()->with; $this->info($contentVars['greeting'] ?? 'Invoice Data Report'); diff --git a/app/Mail/InvoiceDataMail.php b/app/Mail/InvoiceDataMail.php index e92e140..ca36439 100644 --- a/app/Mail/InvoiceDataMail.php +++ b/app/Mail/InvoiceDataMail.php @@ -14,16 +14,20 @@ class InvoiceDataMail extends Mailable { use Queueable, SerializesModels; - public $tableData; public $scheduleType; + public $tableData; + + public $mailSubject; + /** * Create a new message instance. */ - public function __construct($scheduleType,$tableData = []) + public function __construct($scheduleType, $tableData = [], $mailSubject) { - $this->scheduleType = $scheduleType; - $this->tableData = $tableData ?? []; + $this->scheduleType = $scheduleType; + $this->tableData = $tableData ?? []; + $this->mailSubject = $mailSubject ?? 'Invoice Data Report'; } /** @@ -32,7 +36,7 @@ class InvoiceDataMail extends Mailable public function envelope(): Envelope { return new Envelope( - subject: 'Invoice Data Report', + subject: $this->mailSubject, ); } diff --git a/resources/views/mail/invoice_data_report.blade.php b/resources/views/mail/invoice_data_report.blade.php index 1d0aed3..746659b 100644 --- a/resources/views/mail/invoice_data_report.blade.php +++ b/resources/views/mail/invoice_data_report.blade.php @@ -68,8 +68,8 @@
{{ $company }}
-
-

{!! $greeting !!}

+
+

{!! $greeting !!}

@if(empty($tableData))

No invoice data available for this schedule.