2017 © Pedro Peláez
 

library laravel-chat

Laravel chat package

image

deskti/laravel-chat

Laravel chat package

  • Monday, June 12, 2017
  • by socramjunio2
  • Repository
  • 0 Watchers
  • 1 Stars
  • 55 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 7 Versions
  • 10 % Grown

The README.md

Chat

This package allows you to add a chat system to your Laravel 5 application, (*1)

Obs: Chat copiado do musonza/chat apenas para o uso pessoal da Deskti, (*2)

Installation

From the command line, run:, (*3)

composer require deskti/laravel-chat

Add the service provider to your config\app.php the providers array, (*4)

Deskti\Chat\ChatServiceProvider

You can use the facade for shorter code. Add this to your aliases:, (*5)

'Chat' => Deskti\Chat\Facades\ChatFacade::class to your `config\app.php`

The class is bound to the ioC as chat, (*6)

$chat = App::make('chat');

Publish the assets:, (*7)

php artisan vendor:publish

This will publish database migrations and a configuration file chat.php in the Laravel config folder., (*8)

Usage

By default the package assumes you have a User model in the App namespace. However, you can update the user model in 'chat.php' published in the config folder., (*9)

Creating a conversation

$conversation = Chat::createConversation([$userId, $userId2,...]); //takes an array of user ids

Get a conversation given a conversation_id

$conversation = Chat::conversation($conversation_id);

Send a message

Chat::send($conversation->id, 'Hello', $userId); //$userId sending a message to created conversation

Mark message as read

Chat::messageRead($messageId, $userId); //$userId marks the mesage as read

Mark whole conversation as read

Chat::conversationRead($conversation->id, $userId);

Delete a message

Chat::trash($messageId, $userId);

Clear a conversation

Chat::clear($conversation->id, $userId);

Get conversation for two users

Chat::getConversationBetweenUsers($userId, $userId2);

Remove user(s) from conversation

Chat::removeParticipants($conversation->id, $usersId); //removing one user
Chat::removeParticipants($conversation->id, [$usersId, $userId2]); //removing multiple users

Add user(s) to a conversation

Chat::addParticipants($conversation->id, $userId3); //add one user
Chat::addParticipants($conversation->id, [$userId3, $userId4]); //add multiple users

Get messages in a conversation

Chat::messages($userId, $conversation->id, $perPage, $page);

Get recent messages

$mesages = Chat::conversations($userId);

Get users in a conversation

$users = $conversation->users;

The Versions

12/06 2017

dev-master

9999999-dev

Laravel chat package

  Sources   Download

MIT

The Requires

 

laravel messaging chat conversation

12/06 2017

1.0.5

1.0.5.0

Laravel chat package

  Sources   Download

MIT

The Requires

 

laravel messaging chat conversation

12/06 2017

1.0.4

1.0.4.0

Laravel chat package

  Sources   Download

MIT

The Requires

 

laravel messaging chat conversation

28/05 2017

1.0.3

1.0.3.0

Laravel chat package

  Sources   Download

MIT

The Requires

 

laravel messaging chat conversation

28/05 2017

1.0.2

1.0.2.0

Laravel chat package

  Sources   Download

MIT

The Requires

 

laravel messaging chat conversation

28/05 2017

1.0.1

1.0.1.0

Laravel chat package

  Sources   Download

MIT

The Requires

 

laravel messaging chat conversation

28/05 2017

1.0.0

1.0.0.0

Laravel chat package

  Sources   Download

MIT

The Requires

 

laravel messaging chat conversation