Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

1.2 KB
Raw Blame
<?php

namespace HiEvents\Mail\User;

use HiEvents\DomainObjects\UserDomainObject;
use HiEvents\Helper\Url;
use HiEvents\Mail\BaseMail;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;

/**
 * @uses /backend/resources/views/emails/auth/forgot-password.blade.php
 */
class ForgotPassword extends BaseMail
{
    private UserDomainObject $userDomainObject;

    private string $token;

    private ?string $signInProviders = null;

    public function __construct(UserDomainObject $user, string $token, ?string $signInProviders = null)
    {
        parent::__construct();

        $this->userDomainObject = $user;
        $this->token = $token;
        $this->signInProviders = $signInProviders;
    }

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: __('Password reset'),
        );
    }

    public function content(): Content
    {
        return new Content(
            markdown: 'emails.auth.forgot-password',
            with: [
                'user' => $this->userDomainObject,
                'link' => sprintf(Url::getFrontEndUrlFromConfig(Url::RESET_PASSWORD), $this->token),
                'signInProviders' => $this->signInProviders,
            ]
        );
    }
}