PHP code example of sevenspan / laravel-chat
1. Go to this page and download the library: Download sevenspan/laravel-chat 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/ */
sevenspan / laravel-chat example snippets
use SevenSpan\Chat\Facades\Channel;
// $userId = 1; (Required)
// $channelId = 1 (Required)
Channel::clearMessage($userId, $channelId);
use SevenSpan\Chat\Facades\Message;
// $userId = 1; (Required)
// $channelId = 1 (Required)
// $perPage = 10; (Optional)
Message::list($userId, $channelId, $perPage);
use SevenSpan\Chat\Facades\Message;
// $userId = 1; (Required)
// $channelId = 1 (Required)
// $data = [
// 'body' => 'TEXT_MESSAGE',
// 'file' => Image Or Document
// ]; (Required)
Message::send($userId, $channelId, $data);
use SevenSpan\Chat\Facades\Message;
// $userId = 1; (Required)
// $channelId = 1 (Required)
// $type = 'image' (Default: image)
// $perPage = 10; (Optional)
Message::getFiles($userId, $channelId, $type, $perPage);
use SevenSpan\Chat\Facades\Message;
// $userId = 1; (Required)
// $channelId = 1 (Required)
// $messageId = 10; (Required)
Message::delete($userId, $channelId, $messageId);
use SevenSpan\Chat\Facades\Message;
// $userId = 1; (Required)
// $channelId = 1 (Required)
// $messageId = 10; (Required)
Message::read($userId, $channelId, $messageId);
use SevenSpan\Chat\Facades\User;
// $userId = 1; (Required)
// $name = "John Doe" (Optional)
// $perPage = 10; (Optional)
User::list($userId, $name, $perPage);
bash
php artisan vendor:publish --provider="SevenSpan\Chat\Providers\ChatServiceProvider"
php artisan optimize:clear
php artisan migrate