<?php
namespace App\Mail;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class StaffAccountCreated extends Mailable
{
use Queueable, SerializesModels;
public function __construct(
public readonly User $user,
public readonly string $plainPassword,
) {
//
}
public function build(): self
{
$roleLabel = $this->user->role === 'admin' ? 'Admin' : 'Teknisi';
return $this
->subject("Akun {$roleLabel} Helpdesk Anda Sudah Dibuat")
->markdown('emails.staff-account-created', [
'user' => $this->user,
'plainPassword' => $this->plainPassword,
'roleLabel' => $roleLabel,
'loginUrl' => route('login'),
]);
}
}