Fixes adding of subscribers. Closes #944
This commit is contained in:
@@ -24,6 +24,8 @@ class SubscriberHasSubscribedEvent
|
||||
|
||||
/**
|
||||
* Create a new subscriber has subscribed event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subscriber $subscriber)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,8 @@ class SubscriberHasUnsubscribedEvent
|
||||
|
||||
/**
|
||||
* Create a new subscriber has unsubscribed event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subscriber $subscriber)
|
||||
{
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Cachet.
|
||||
*
|
||||
* (c) Alt Three Services Limited
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace CachetHQ\Cachet\Handlers\Events;
|
||||
|
||||
use CachetHQ\Cachet\Events\SubscriberHasSubscribedEvent;
|
||||
use Illuminate\Contracts\Mail\MailQueue;
|
||||
use Illuminate\Mail\Message;
|
||||
|
||||
class SendSubscriberVerificationEmailHandler
|
||||
{
|
||||
/**
|
||||
* The mailer instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Mail\MailQueue
|
||||
*/
|
||||
protected $mailer;
|
||||
|
||||
/**
|
||||
* Create a new send subscriber verification email handler.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MailQueue $mailer)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Events\CustomerHasSubscribedEvent $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(SubscriberHasSubscribedEvent $event)
|
||||
{
|
||||
$mail = [
|
||||
'email' => $event->subscriber->email,
|
||||
'subject' => 'Confirm your subscription.',
|
||||
'link' => route('subscribe.verify', ['code' => $event->subscriber->verify_code]),
|
||||
'app_url' => env('APP_URL'),
|
||||
];
|
||||
|
||||
$this->mailer->queue([
|
||||
'html' => 'emails.subscribers.verify-html',
|
||||
'text' => 'emails.subscribers.verify-text',
|
||||
], $mail, function (Message $message) use ($mail) {
|
||||
$message->to($mail['email'])->subject($mail['subject']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Handlers\Events\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Events\SubscriberHasSubscribedEvent;
|
||||
use CachetHQ\Cachet\Events\Subscriber\SubscriberHasSubscribedEvent;
|
||||
use Illuminate\Contracts\Mail\MailQueue;
|
||||
use Illuminate\Mail\Message;
|
||||
|
||||
@@ -39,7 +39,7 @@ class SendSubscriberVerificationEmailHandler
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \CachetHQ\Cachet\Events\CustomerHasSubscribedEvent $event
|
||||
* @param \CachetHQ\Cachet\Events\SubscriberHasSubscribedEvent $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ class EventServiceProvider extends ServiceProvider
|
||||
*/
|
||||
protected $listen = [
|
||||
'CachetHQ\Cachet\Events\Subscriber\SubscriberHasSubscribedEvent' => [
|
||||
'CachetHQ\Cachet\Handlers\Events\SendSubscriberVerificationEmailHandler',
|
||||
'CachetHQ\Cachet\Handlers\Events\Subscriber\SendSubscriberVerificationEmailHandler',
|
||||
],
|
||||
'CachetHQ\Cachet\Events\Incident\IncidentWasReportedEvent' => [
|
||||
'CachetHQ\Cachet\Handlers\Events\Incident\SendIncidentEmailNotificationHandler',
|
||||
|
||||
Reference in New Issue
Block a user