diff --git a/app/Services/NotificationService.php b/app/Services/NotificationService.php index b997f70..cf82a1b 100644 --- a/app/Services/NotificationService.php +++ b/app/Services/NotificationService.php @@ -9,8 +9,15 @@ class NotificationService{ public static function sendEntityNotification(Entity $entity,$notification){ $admins = User::activeAdmins()->select('id', 'email')->get(); + + $operators = $entity->operators->pluck('id')->toArray(); + + $filteredAdmins = $admins->filter(function ($admin) use ($operators) { + return !in_array($admin->id, $operators); + }); + Notification::sendNow($entity->operators, new $notification($entity)); - Notification::sendNow($admins, new $notification($entity)); + Notification::sendNow($filteredAdmins, new $notification($entity)); } }