Skip to content

Commit

Permalink
make new NotificationService (not tested)
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Jul 12, 2024
1 parent 7eac6ef commit eb4e015
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/Services/NotificationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

}

0 comments on commit eb4e015

Please sign in to comment.