PHP code example of murkrow / simple-chat

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';
    }
}
bash
php artisan vendor:publish --provider="Murkrow\Chat\ChatServiceProvider" --force
bash
npm install --save-dev laravel-echo pusher-js
bash
composer