serial = $serial; // $this->invoiceNumber = $invoiceNumber; // $this->plantName = $plantName; // $this->invoiceType = $invoiceType; // } // /** // * Get the message envelope. // */ // public function envelope(): Envelope // { // return new Envelope( // subject: 'Invalid Serial Mail', // ); // } // /** // * Get the message content definition. // */ // public function content(): Content // { // $greeting = "Dear Sir/Madam,

Please note that the scanned serial number format appears to be incorrect."; // return new Content( // view: 'mail.invalid-serial', // with: [ // 'company' => "CRI Digital Manufacturing Solutions", // 'greeting' => $greeting, // 'wishes' => "Thanks & Regards,
CRI Digital Manufacturing Solutions" // ], // ); // } // /** // * Get the attachments for the message. // * // * @return array // */ // public function attachments(): array // { // return []; // } // } class InvalidSerialMail extends Mailable { use Queueable, SerializesModels; public $serial; public $invoiceNumber; public $mplantName; public $mInvoiceType; public $mailType; // new public $greeting; public $subjectLine; public $itemCode; /** * Create a new message instance. */ public function __construct($serial, $invoiceNumber, $mplantName, $mInvoiceType, $itemCode, $mailType = 'InvalidFormat') { $this->serial = $serial; $this->invoiceNumber = $invoiceNumber; $this->mplantName = $mplantName; $this->mInvoiceType = $mInvoiceType; $this->mailType = $mailType; $this->itemCode = $itemCode; } /** * Get the message envelope. */ public function envelope(): Envelope { // dynamic subject based on mail type switch ($this->mailType) { case 'NotFoundInvoice': $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})"; break; case 'DuplicateCapacitorQR': $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})"; break; case 'CompletedSerialInvoice': $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})"; break; case 'CSerialInvoice': $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})"; break; case 'ComSerInv': $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})"; break; } return new Envelope( subject: $this->subjectLine, ); } /** * Get the message content definition. */ public function content(): Content { // dynamic greeting/message body switch ($this->mailType) { case 'NotFoundInvoice': $this->greeting = " Dear Sir/Madam,

The scanned serial number could not be found in the given invoice.

Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'DuplicateCapacitorQR': $this->greeting = " Dear Sir/Madam,

The scanned Capacitor serial number has already completed the scanning process.

Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'CompletedSerialInvoice': $this->greeting = " Dear Sir/Madam,

Serial invoice '{$this->invoiceNumber}' completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'CSerialInvoice': $this->greeting = " Dear Sir/Madam,

Serial invoice '{$this->invoiceNumber}' completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'ComSerInv': $this->greeting = " Dear Sir/Madam,

Serial invoice '{$this->invoiceNumber}' completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; } return new Content( view: 'mail.invalid-serial', with: [ 'company' => "CRI Digital Manufacturing Solutions", 'greeting' => $this->greeting, 'wishes' => "Thanks & Regards,
CRI Digital Manufacturing Solutions", ], ); } }