55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
class NeblogisticStatusUpdate extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public $data;
|
|
public $recipientType; // 'abm' or 'tm'
|
|
|
|
/**
|
|
* Create a new message instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($data, $recipientType = 'tm')
|
|
{
|
|
$this->data = $data;
|
|
$this->recipientType = $recipientType;
|
|
}
|
|
|
|
/**
|
|
* Build the message.
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function build()
|
|
{
|
|
$address = 'support1@stratawiz.com';
|
|
$name = 'GNP Support Team';
|
|
|
|
$status = $this->data['status'];
|
|
$orderNo = $this->data['order_no'] ?? 'N/A';
|
|
|
|
$subject = "Order Status Update: {$status} - Order #{$orderNo}";
|
|
|
|
// Choose template based on recipient type
|
|
$view = 'email.neblogistic_status_update';
|
|
|
|
return $this->view($view)
|
|
->from($address, $name)
|
|
->replyTo($address, $name)
|
|
->subject($subject)
|
|
->with([
|
|
'data' => $this->data,
|
|
'recipientType' => $this->recipientType
|
|
]);
|
|
}
|
|
}
|