| @@ 18-61 (lines=44) @@ | ||
| 15 | use Illuminate\Contracts\Mail\MailQueue; |
|
| 16 | use Illuminate\Mail\Message; |
|
| 17 | ||
| 18 | class SendSubscriberVerificationEmailHandler |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * The mailer instance. |
|
| 22 | * |
|
| 23 | * @var \Illuminate\Contracts\Mail\MailQueue |
|
| 24 | */ |
|
| 25 | protected $mailer; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Create a new send subscriber verification email handler. |
|
| 29 | * |
|
| 30 | * @param \Illuminate\Contracts\Mail\Mailer $mailer |
|
| 31 | */ |
|
| 32 | public function __construct(MailQueue $mailer) |
|
| 33 | { |
|
| 34 | $this->mailer = $mailer; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Handle the event. |
|
| 39 | * |
|
| 40 | * @param \Gitamin\Events\SubscriberHasSubscribedEvent $event |
|
| 41 | */ |
|
| 42 | public function handle(SubscriberHasSubscribedEvent $event) |
|
| 43 | { |
|
| 44 | $mail = [ |
|
| 45 | 'email' => $event->subscriber->email, |
|
| 46 | 'subject' => 'Confirm your subscription.', |
|
| 47 | 'link' => route('subscribe.verify', ['code' => $event->subscriber->verify_code]), |
|
| 48 | ]; |
|
| 49 | ||
| 50 | $this->mailer->queue([ |
|
| 51 | 'html' => 'emails.subscribers.verify-html', |
|
| 52 | 'text' => 'emails.subscribers.verify-text', |
|
| 53 | ], $mail, function (Message $message) use ($mail) { |
|
| 54 | $message->to($mail['email'])->subject($mail['subject']); |
|
| 55 | }); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 18-61 (lines=44) @@ | ||
| 15 | use Illuminate\Contracts\Mail\MailQueue; |
|
| 16 | use Illuminate\Mail\Message; |
|
| 17 | ||
| 18 | class SendInviteUserEmailHandler |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * The mailer instance. |
|
| 22 | * |
|
| 23 | * @var \Illuminate\Contracts\Mail\MailQueue |
|
| 24 | */ |
|
| 25 | protected $mailer; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Create a new send invite user email handler. |
|
| 29 | * |
|
| 30 | * @param \Illuminate\Contracts\Mail\Mailer $mailer |
|
| 31 | */ |
|
| 32 | public function __construct(MailQueue $mailer) |
|
| 33 | { |
|
| 34 | $this->mailer = $mailer; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Handle the event. |
|
| 39 | * |
|
| 40 | * @param \Gitamin\Events\UserWasInvitedEvent $event |
|
| 41 | */ |
|
| 42 | public function handle(UserWasInvitedEvent $event) |
|
| 43 | { |
|
| 44 | $mail = [ |
|
| 45 | 'email' => $event->invite->email, |
|
| 46 | 'subject' => 'You have been invited.', |
|
| 47 | 'link' => route('signup.invite', ['code' => $event->invite->code]), |
|
| 48 | ]; |
|
| 49 | ||
| 50 | $this->mailer->queue([ |
|
| 51 | 'html' => 'emails.users.invite-html', |
|
| 52 | 'text' => 'emails.users.invite-text', |
|
| 53 | ], $mail, function (Message $message) use ($mail) { |
|
| 54 | $message->to($mail['email'])->subject($mail['subject']); |
|
| 55 | }); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||