Skip to content

Commit

Permalink
Merge pull request #279 from tolgatasci/patch-1
Browse files Browse the repository at this point in the history
Update MessageNotification.php
  • Loading branch information
musonza authored May 12, 2021
2 parents a229349 + cc40edb commit 450eb34
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Models/MessageNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}

Expand Down

0 comments on commit 450eb34

Please sign in to comment.