request = $request;
$this->approverName = $approverName;
$this->level = $level;
$this->pdfPath = $pdfPath;
$this->tableData = $characteristics;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: 'Characteristic Approval Mail',
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
view: 'mail.characteristic-approval',
with: [
'company' => 'CRI Digital Manufacturing Solutions',
'greeting' => 'Dear ' . $this->approverName . ',',
'request' => $this->request,
'tableData' => $this->tableData,
'approveUrl' => $this->approveUrl(),
'holdUrl' => $this->holdUrl(),
'rejectUrl' => $this->rejectUrl(),
'wishes' => 'Thanks & Regards,
CRI Digital Manufacturing Solutions',
]
);
}
protected function approveUrl()
{
return URL::signedRoute('characteristic.approve', [
'id' => $this->request->id,
'level' => $this->level
]);
}
protected function holdUrl()
{
return URL::signedRoute('characteristic.hold', [
'id' => $this->request->id,
'level' => $this->level
]);
}
protected function rejectUrl()
{
return URL::signedRoute('characteristic.reject', [
'id' => $this->request->id,
'level' => $this->level
]);
}
/**
* Get the attachments for the message.
*
* @return array
*/
public function attachments(): array
{
if (! $this->pdfPath) {
return [];
}
if (! Storage::disk('local')->exists($this->pdfPath)) {
return [];
}
return [
Attachment::fromStorageDisk(
'local',
$this->pdfPath
)->as(basename($this->pdfPath)),
];
}
}