From 6655cefaec943960455f348cee30b9f62b0a74ff Mon Sep 17 00:00:00 2001 From: Louis Jeckel Date: Wed, 16 Dec 2020 18:11:47 +0100 Subject: [PATCH] unsub --- app/Events/DispatchMailgunEvent.php | 5 +---- app/User.php | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/Events/DispatchMailgunEvent.php b/app/Events/DispatchMailgunEvent.php index 77f7cd9..5528667 100644 --- a/app/Events/DispatchMailgunEvent.php +++ b/app/Events/DispatchMailgunEvent.php @@ -73,11 +73,8 @@ class DispatchMailgunEvent implements ShouldBroadcast $event->touch(); $this->data = $event; - /** - * @todo track unsubscribes - */ if($event->event === 'unsubscribed') { -// $event->user->unsubscribe(); + $event->user->unsubscribe(); } diff --git a/app/User.php b/app/User.php index 81974e7..02420d2 100644 --- a/app/User.php +++ b/app/User.php @@ -402,7 +402,7 @@ class User extends Authenticatable implements MustVerifyEmail, SendsEmails */ public function scopeReceivesEmails(Builder $builder): void { - $builder->where('unsubscribed', '0'); +// $builder->where('unsubscribed', '0'); $builder->where(function($builder) { // $builder->hasActiveSubscription()->orWhere->isOnTrial()->orWhere->isOnDiscovery(); $builder->where('type', User::TYPE_SUBSCRIBER)->orWhere->isOnTrial()->orWhere->isOnDiscovery(); -- 2.39.5