Created
October 2, 2017 04:09
-
-
Save renepardon/0086ca7a091acd5dffa72e6e229f0a69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Listeners\Trainer; | |
use App\Event\UserRegistered; | |
use App\I18nTrait; | |
use App\Mail\Trainer\Welcome; | |
use Illuminate\Config\Repository as Config; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Mail\Mailer; | |
use Illuminate\Queue\InteractsWithQueue; | |
/** | |
* Class SendWelcomeMail | |
* | |
* @package App\Listeners | |
*/ | |
class SendWelcomeMail implements ShouldQueue | |
{ | |
use InteractsWithQueue, I18nTrait; | |
/** | |
* @var UserRegistered | |
*/ | |
public $event; | |
/** | |
* @var Config | |
*/ | |
protected $config; | |
/** | |
* @var Mailer | |
*/ | |
protected $mailer; | |
/** | |
* @param Config $config | |
*/ | |
public function __construct(Config $config, Mailer $mailer) | |
{ | |
$this->config = $config; | |
$this->mailer = $mailer; | |
} | |
/** | |
* @param UserRegistered $event | |
* | |
* @return void | |
*/ | |
public function handle(UserRegistered $event) | |
{ | |
$this->event = $event; | |
$this->setUserLocale($this->event->user->flag->interface_language); | |
$this->mailer->to($this->event->user->email) | |
->send(new Welcome($this->event->user)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment