From 5e5c2fdf0419df30d9bc3ed6da4df05e8effe48d Mon Sep 17 00:00:00 2001 From: Steven Ngesera Date: Mon, 9 Dec 2024 20:35:34 +0300 Subject: [PATCH] fix undefined key with queue --- services/Core/Jobs/Hm_BaseJob.php | 1 + services/Core/Notifications/Hm_Notification.php | 3 ++- services/Notifications/Hm_NewMailNotification.php | 9 ++------- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/services/Core/Jobs/Hm_BaseJob.php b/services/Core/Jobs/Hm_BaseJob.php index e6597d87f..dbced8d9b 100644 --- a/services/Core/Jobs/Hm_BaseJob.php +++ b/services/Core/Jobs/Hm_BaseJob.php @@ -9,5 +9,6 @@ abstract class Hm_BaseJob extends Hm_Queueable implements Hm_Job { public function __construct(protected array $data = []) { $this->data = $data; + $this->driver = env('QUEUE_DRIVER'); } } diff --git a/services/Core/Notifications/Hm_Notification.php b/services/Core/Notifications/Hm_Notification.php index 6d2e04a3e..04aa5a223 100644 --- a/services/Core/Notifications/Hm_Notification.php +++ b/services/Core/Notifications/Hm_Notification.php @@ -29,6 +29,7 @@ class Hm_Notification extends Hm_Queueable implements Hm_Dispatcher public function __construct($content = '') { $this->content = $content; + $this->driver = env('QUEUE_DRIVER'); } /** * Notifcations can be sent through multiple channels. @@ -43,7 +44,7 @@ public function via(): array public function handle(): void { dump("Processing ".self::class); - + $this->sendNow(); } public function failed(): void diff --git a/services/Notifications/Hm_NewMailNotification.php b/services/Notifications/Hm_NewMailNotification.php index 426f5e6f4..b7d3dab2b 100644 --- a/services/Notifications/Hm_NewMailNotification.php +++ b/services/Notifications/Hm_NewMailNotification.php @@ -11,15 +11,10 @@ class Hm_NewMailNotification extends Hm_Notification implements Hm_ShouldQueue { use Hm_Dispatchable, Hm_InteractsWithQueue; - public string $driver = 'redis'; - - // public function __construct(array $config = []) - // { - // parent::__construct($config); - // } + public string $driver = 'database'; public function via(): array { - return ['telegram'];//, 'slack', 'telegram','broadcast' + return ['telegram','slack'];//, 'slack', 'telegram','broadcast' } }