cmgmyr / laravel-messenger

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

Close && Open Threads #243

Closed mortezaf closed 7 years ago

mortezaf commented 7 years ago

Hi man tanx a lot for this awesome package How can i close a thread?

antonkomarev commented 7 years ago

What you mean by Close a thread? Prevent anybody to write there or make it password protected?

One of the solutions is extend Thread model, add functionality you need for it and switch from default model to your custom one in config/messenger.php.

'thread_model' => App\YourCustomThread::class,
mortezaf commented 7 years ago

i mean to Prevent anybody to write?

antonkomarev commented 7 years ago

Then add is_closed boolean column to your threads database table, extend Thread model with your own class where you will make checks if thread is closed\opened and handle close() method which will change is_closed value. Then instruct Laravel Messenger in package config to use your extended version of Thread instead of default one (read my previous comment).

antonkomarev commented 7 years ago

This package provides only base functionality required for all of the messenger features and gives developer an ability to extend behavior with their own business requirements. It's not Out of the box solution for all messenger use cases, look on it as on framework to create your messenger.

cmgmyr commented 7 years ago

@MortezaFathi, @a-komarev's outline is the only way to do this with the package at the moment. Again, this is done to leave the option for the developer to implement any options or implementations needed. We've discussed adding some additional actions to the package (see #153), but these haven't been fleshed out fully or implemented yet. Feel free to add some more information or usages to that issue number if you'd like.

Thanks for using the package!