From f3b54693857df1a234492463467e4d9befd2fa14 Mon Sep 17 00:00:00 2001 From: Tolga Date: Wed, 17 Mar 2021 21:49:16 +0300 Subject: [PATCH 1/4] Update MessageNotification.php Prepared statement contains error fix https://github.com/musonza/chat/issues/278 --- src/Models/MessageNotification.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Models/MessageNotification.php b/src/Models/MessageNotification.php index c2026a4..c84452d 100644 --- a/src/Models/MessageNotification.php +++ b/src/Models/MessageNotification.php @@ -38,7 +38,7 @@ public function unReadNotifications(Model $participant) public static function createCustomNotifications($message, $conversation) { $notification = []; - + $i=0; foreach ($conversation->participants as $participation) { $is_sender = ($message->participation_id == $participation->id) ? 1 : 0; @@ -52,8 +52,14 @@ public static function createCustomNotifications($message, $conversation) 'is_sender' => $is_sender, 'created_at' => $message->created_at, ]; + $i++; + if($i>1000){ + self::insert($notification); + $i = 0; + $notification=[] + } } - + self::insert($notification); } From 4f0ca58242c2cacc9cd1cb93880dc47fd40983f8 Mon Sep 17 00:00:00 2001 From: Tolga Date: Wed, 17 Mar 2021 21:51:01 +0300 Subject: [PATCH 2/4] Update MessageNotification.php --- src/Models/MessageNotification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Models/MessageNotification.php b/src/Models/MessageNotification.php index c84452d..03dec01 100644 --- a/src/Models/MessageNotification.php +++ b/src/Models/MessageNotification.php @@ -56,7 +56,7 @@ public static function createCustomNotifications($message, $conversation) if($i>1000){ self::insert($notification); $i = 0; - $notification=[] + $notification=[]; } } From 8b999a3c0664febc8b48e705bb2b5965e48e9dce Mon Sep 17 00:00:00 2001 From: Tolga Date: Wed, 17 Mar 2021 21:56:26 +0300 Subject: [PATCH 3/4] Update MessageNotification.php --- src/Models/MessageNotification.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Models/MessageNotification.php b/src/Models/MessageNotification.php index 03dec01..dfc2243 100644 --- a/src/Models/MessageNotification.php +++ b/src/Models/MessageNotification.php @@ -38,7 +38,7 @@ public function unReadNotifications(Model $participant) public static function createCustomNotifications($message, $conversation) { $notification = []; - $i=0; + $i = 0; foreach ($conversation->participants as $participation) { $is_sender = ($message->participation_id == $participation->id) ? 1 : 0; @@ -53,11 +53,11 @@ public static function createCustomNotifications($message, $conversation) 'created_at' => $message->created_at, ]; $i++; - if($i>1000){ - self::insert($notification); - $i = 0; - $notification=[]; - } + if ($i > 1000) { + self::insert($notification); + $i = 0; + $notification = []; + } } self::insert($notification); From cc40edbe982aab94618b3bf9644b6b18ed4a99c9 Mon Sep 17 00:00:00 2001 From: Tolga Date: Wed, 17 Mar 2021 21:58:28 +0300 Subject: [PATCH 4/4] Update MessageNotification.php --- src/Models/MessageNotification.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Models/MessageNotification.php b/src/Models/MessageNotification.php index dfc2243..ef4d931 100644 --- a/src/Models/MessageNotification.php +++ b/src/Models/MessageNotification.php @@ -57,9 +57,8 @@ public static function createCustomNotifications($message, $conversation) self::insert($notification); $i = 0; $notification = []; - } + } } - self::insert($notification); }