From 9c8c85bcc7b278637412f96bb5a71dd4cd4877ee Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Thu, 28 Oct 2021 13:18:01 +0100 Subject: [PATCH] Fix user notification v3 --- app/Listeners/NotifyUser.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Listeners/NotifyUser.php b/app/Listeners/NotifyUser.php index 3d3e900..e5e663c 100644 --- a/app/Listeners/NotifyUser.php +++ b/app/Listeners/NotifyUser.php @@ -9,6 +9,7 @@ use GuzzleHttp\Client; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Support\Facades\Log; +use stdClass; use Throwable; class NotifyUser @@ -43,7 +44,7 @@ class NotifyUser $headers = [ 'Authorization' => config('services.notification_service.key'), ]; - $body = new \stdClass(); + $body = new stdClass(); $body->title = $event->mailTitle; $body->message = $event->mailMessage; $body->email = $user->email; @@ -51,13 +52,15 @@ class NotifyUser $client->request('POST', '/send-mail', ['json' => $body, 'headers' => $headers]); if (isset($event->notification)) { - $body = new \stdClass(); + $body = new stdClass(); $body->user_code = $user->user_code; $body->message = $event->notification; - $data = new \stdClass(); + $data = new stdClass(); $data->screen = "notificationview"; - $data->data = new \stdClass(); + $data->data = new stdClass(); $data->data->subscription_id = $data->data->id = $subscription->id; + $body->data = $data; + try { $body->date = $this->getCurrentTimeByCountryCode($user->network->country->code_country); } catch (Throwable $t) {