1. Go to this page and download the library: Download murkrow/simple-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/ */
murkrow / simple-chat example snippets
use Murkrow\Chat\Traits\CanChat;
class User
{
use CanChat;
}
class User
{
use CanChat;
public function getSecondLineAttribute(): string
{
return $this->email;
}
public function getAvatarUrlAttribute(): string
{
return $this->avatar;
}
public function getUsersToStartChatWith() : Builder
{
return Utils::getUserClass()::where('id', '!=', $this->id);
}
public function canChatWith($targetUserId): bool
{
return $targetUserId->role !== 'admin';
}
}