PasswordResetMailer.php 734 Bytes
<?php

namespace FootyRoom\User;

use Illuminate\Contracts\Mail\Mailer;

class PasswordResetMailer
{
    /**
     * @var \Illuminate\Contracts\Mail\Mailer
     */
    protected $mailer;

    public function __construct(Mailer $mailer)
    {
        $this->mailer = $mailer;
    }

    public function send($email, $username, $token)
    {
        $this->mailer->send(
            ['text' => 'emails.passwordResetAsText'],
            ['username' => $username, 'token' => $token],
            function ($m) use ($username, $email) {
                $m->from('donotreply@footyroom.com', 'FootyRoom');
                $m->to($email, $username);
                $m->subject('Password Reset - FootyRoom');
            }
        );
    }
}