cmgmyr / laravel-messenger

Simple user messaging package for Laravel
MIT License
2.46k stars 517 forks source link

How to send message to all users and attach file? #234

Closed Mioleris closed 7 years ago

Mioleris commented 7 years ago

Hi, I want to send message to all user as main admin. But there is about 20k users so every time when I want to send message to all users it adds 20k records in DB every time. Someone is using like this or there is other way ?

And how about attachments in message ? Should I create attachments and messages_attachments tables to manage message attachments by my self?

antonkomarev commented 7 years ago

Hello, @Mioleris!

I'm not sure that this package is good choice for announcements. Especially if you are not planning to receive answers from all 20k users. For such a things I'd recommend to use standard Laravel Notifications.

Accordingly to attachments, yes you need to implement this feature by yourself. This package provide only base text message functionality. Some more explanations: #162

cmgmyr commented 7 years ago

@a-komarev - hmm, I believe the native notifications will do the same thing (using the DB option) - unless I'm missing something?

@Mioleris - do you need the users to reply to the message/notification? If not, maybe you can get away with having site-wide notifications (1 record) with an optional attachment (1 record), and have an additional table for read/unread statuses (20k records).

antonkomarev commented 7 years ago

@cmgmyr You are right. It will create the same thing, but it wouldn't create Thread for each notification, it wouldn't add 2 participants to it. And if you need just to send announcements and don't need to receive any feedback in the chat - using messenger for it is redundantly in my point of view.

cmgmyr commented 7 years ago

@a-komarev agreed :)

Mioleris commented 7 years ago

Thanks guys for explanation :) I think I will stick with second option as @cmgmyr commented because I don't need to receive replies from users :)

antonkomarev commented 7 years ago

@Mioleris Yep, that's seems to be the best approach.