PHP code example of syriable / laravel-converse

1. Go to this page and download the library: Download syriable/laravel-converse 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/ */

    

syriable / laravel-converse example snippets


$buyer->messageTo($seller)->text('Hi! Is this service available?')->send();

use Syriable\Converse\Concerns\HasConversations;

class User extends Authenticatable
{
    use HasConversations;
}

// Send a message — resolves or creates the pair's conversation automatically.
$message = $buyer->messageTo($seller)->text('Can you design a minimal logo?')->send();

// Reply, attach a file, or send a structured type.
$buyer->messageTo($seller)->replyTo($message)->text('Sounds good!')->send();
$buyer->messageTo($seller)->text('Reference image attached')->attach($uploadedFile)->send();
$seller->messageTo($buyer)->custom('offer', ['price' => 120, 'days' => 4])->send();

// Read the inbox.
$buyer->conversations()->inbox()->cursorPaginate(20);
$message->conversation->messagesFor($buyer)->cursorPaginate(50);
$message->conversation->markReadBy($buyer);

// Organize.
$message->conversation->archiveFor($buyer);
$message->conversation->starFor($buyer);

// Block, report, moderate.
$buyer->block($seller, 'spam');
$message->reportBy($buyer, reason: 'inappropriate');

// Presence-aware notifications — nothing extra to call. An offline
// recipient gets emailed; an online one gets a real-time in-app
// notification instead, and never both.
$buyer->messageTo($seller)->text('Hello!')->send();     // routed automatically