ActivationKeyMailer.php 762 Bytes
<?php

namespace FootyRoom\Services\Registration;

use Illuminate\Contracts\Mail\Mailer;

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

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

    public function send($userId, $username, $email, $key)
    {
        $this->mailer->send(
            ['emails.activation', 'emails.activationAsText'],
            ['userId' => $userId, 'activationKey' => $key],
            function ($m) use ($username, $email) {
                $m->from('donotreply@footyroom.com', 'FootyRoom');
                $m->to($email, $username);
                $m->subject('Welcome to FootyRoom');
            }
        );
    }
}