diff --git a/src/Models/MessageNotification.php b/src/Models/MessageNotification.php index c2026a4..ef4d931 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,13 @@ 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); }