49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Models\ESign\EsignContract;
|
|
use App\Models\ESign\EsignSigner;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Address;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Collection;
|
|
|
|
class EsignCompletedMail extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public function __construct(
|
|
public EsignContract $contract,
|
|
public EsignSigner $signer,
|
|
public Collection $allSigners,
|
|
) {}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
return new Envelope(
|
|
from: new Address(config('mail.contact_from_address', config('mail.from.address')), config('mail.from.name')),
|
|
subject: "[SAM] 전자계약 서명 완료 - {$this->contract->title}",
|
|
);
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
$downloadUrl = config('app.url').'/esign/sign/'.$this->signer->access_token.'/api/document';
|
|
|
|
return new Content(
|
|
html: 'emails.esign.completed',
|
|
with: [
|
|
'contractTitle' => $this->contract->title,
|
|
'signerName' => $this->signer->name,
|
|
'completedAt' => $this->contract->completed_at?->format('Y-m-d H:i'),
|
|
'allSigners' => $this->allSigners,
|
|
'downloadUrl' => $downloadUrl,
|
|
],
|
|
);
|
|
}
|
|
}
|