PHP code example of metko / galera

1. Go to this page and download the library: Download metko/galera library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

metko / galera example snippets


// 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);

Galera::conversation($id)->clear();

Galera::conversation($id)->close(); return Metko\Galera\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); 

Galera::conversation($id)->readAll(); 

$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

$user->getLastConversation($withMessage = false, $nbMessage = 25); // Return Collection

Galera::ofConversation($conversationId)->get(); 

Galera::conversation($id)->unread_messages_count; 

Galera::conversation($id)->messages_count; 
bash
php artisan pusblish --tag:galera