Package Data | |
---|---|
Maintainer Username: | metko |
Maintainer Contact: | thomas.moiluiavon@gmail.com (Thomas Moiluiavon) |
Package Create Date: | 2019-07-02 |
Package Last Update: | 2019-12-06 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:20:14 |
Package Statistics | |
---|---|
Total Downloads: | 17 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Galera is small package to handle conversation between two or multiple user.
composer require metko/galera
Publish the config file and the asset
php artisan pusblish --tag:galera
Use the trait Galerable in your user model
// Metko\Galera\Galerable;
use Galerable;
Galera::participants($user1, $user2)->make();
*// Or pass an array of multiple user*
Galera::addParticipants([1,2,3,'10'])->make();
Galera::conversation($id);
// Or with the messages
Galera::conversation($id, true);
*Return a conversation with [‘messages_count’, ’unread_messages_count’] by default *
Galera::conversation($id)->clear();
Will soft delete all the message of the given conversation
Galera::conversation($id)->close(); return Metko\Galera\Conversation
Nobody can submit a message in a close conversation
Galera::conversation($id)->isCLosed(); // return bool
Galera::conversation($id)->add(1);
// Or many user at the same time
Galera::conversation($id)->addMany([1, $user2, '3']);
Galera::conversation($id)->remove(1);
A conversation must have at least 2 participants. It will return an error if you try to do it.
Galera::conversation($id)->readAll();
A conversation must have at least 2 participants. It will return an error if you try to do it.
$user->write(‘My message’, $conversationId); // You can pass a model or an id for the conversation
Galera::message(1)->delete(); // You can pass a model or an id for the conversation param*
$user->write(‘My message’, $conversationId, $message->id); // You can pass a model or an id for the message param*
$user->hasUnreadMessage($convzersationId); // Return bool
//Or in all conversation where he is participant
$user->hasUnreadMessage(); // Return bool
$user->unreadMessages();
$user->readAll($convzersationId); // Return Collection
Return a list of all conversation ordered by updated_at, count of message, and unread_message_count
$user->getLastConversation($withMessage = false, $nbMessage = 25); // Return Collection
Return a list of all conversation ordered by updated_at, count of message, and unread_message_count
Galera::ofConversation($conversationId)->get();
Galera::conversation($id)->unread_messages_count;
Galera::conversation($id)->messages_count;
The package includes three test cases:
TestCase
- Effectively the normal Laravel test case. Use it the same way you would your normal Laravel test caseSimpleTestCase
- Extends the default PHPUnit test case, so it doesn’t set up a Laravel application, making it quicker and well-suited to properly isolated unit testsBrowserKitTestCase
- Sets up BrowserKit