Files
sam-manage/app/Mail/UserPasswordMail.php
hskwon 85cbe23782 feat: [users] 사용자 등록 시 비밀번호 자동 생성 및 이메일 발송
- 사용자 등록 시 비밀번호 입력 필드 제거
- 임의 비밀번호 자동 생성 후 이메일 발송
- 사용자 수정 페이지에 비밀번호 초기화 버튼 추가
- 사용자 모달에 비밀번호 초기화 버튼 추가
- 사용자 모달 프로필 이미지 없을 때 이름 첫글자 표시 (한글 지원)
- UserPasswordMail 클래스 및 이메일 템플릿 추가
2025-12-01 10:50:16 +09:00

59 lines
1.2 KiB
PHP

<?php
namespace App\Mail;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class UserPasswordMail extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*/
public function __construct(
public User $user,
public string $password,
public bool $isNewUser = true
) {}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
$subject = $this->isNewUser
? '[SAM] 계정이 생성되었습니다'
: '[SAM] 비밀번호가 초기화되었습니다';
return new Envelope(
subject: $subject,
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
view: 'emails.user-password',
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}