- PayslipMail Mailable 클래스 생성 (admin@codebridge-x.com 발송) - 급여명세서 이메일 템플릿 (전통 한국식 양식) - 이메일 발송 API 엔드포인트 추가 (POST /payrolls/{id}/send-payslip) - 목록 테이블에 이메일 발송 아이콘 버튼 추가 - 급여명세서 미리보기 모달 + 인쇄 기능
42 lines
981 B
PHP
42 lines
981 B
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class PayslipMail extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public function __construct(
|
|
public array $payslipData
|
|
) {}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
$year = $this->payslipData['pay_year'] ?? '';
|
|
$month = str_pad($this->payslipData['pay_month'] ?? '', 2, '0', STR_PAD_LEFT);
|
|
|
|
return new Envelope(
|
|
from: new \Illuminate\Mail\Mailables\Address('admin@codebridge-x.com', '(주)코드브릿지엑스'),
|
|
subject: "[SAM] {$year}년{$month}월분 급여명세서",
|
|
);
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
view: 'emails.payslip',
|
|
);
|
|
}
|
|
|
|
public function attachments(): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|