[ 'subject' => 'Your login code', 'intro' => 'Your login code is:', ], 'wipe-catalog' => [ 'subject' => 'Confirm: Wipe Catalog', 'intro' => 'Someone requested to permanently delete every product in the catalog. If this was you, enter this code to confirm:', ], ]; public function __construct( public readonly string $name, public readonly string $code, public readonly string $purpose = 'login', ) {} public function envelope(): Envelope { return new Envelope(subject: $this->copy()['subject']); } public function content(): Content { return new Content(view: 'core::auth.mail.otp', with: ['intro' => $this->copy()['intro']]); } private function copy(): array { return self::COPY_BY_PURPOSE[$this->purpose] ?? self::COPY_BY_PURPOSE['login']; } }