machour / yii2-notifications

A complete notifications module for your Yii 2 powered application
MIT License
90 stars 48 forks source link

How to send notification to multiple users? #58

Closed kwazaro closed 6 years ago

kwazaro commented 6 years ago

Hello! How can I send notification for multiple users (for example, by role). I need a group of managers to see the notifications, but I can pass only one $admin_id in Notification::notify() function. Is there a way to notify all registered users, or other group of users?

thattejada commented 6 years ago

What if you try to group your users by role, and then you can find them as shown here

kwazaro commented 6 years ago

Should I send notification to every user of specific role separately? Or I can do it for whole group of users at the same time?

AlessandroCuba commented 6 years ago

yo can do a foreach

ej. foreach($users as $user){ Notification::notify(Notification::KEY_NEW_MESSAGE, $user->id, $message->id); }