2017 © Pedro Peláez
 

library admin_user_chat

A simple chat between users and an admin

image

norris1z/admin_user_chat

A simple chat between users and an admin

  • Sunday, February 26, 2017
  • by Norris1z
  • Repository
  • 1 Watchers
  • 1 Stars
  • 169 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

Laravel - AdminUserChat

A Laravel chat package to facilitate chatting between users and administrators, (*1)

Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

Installation

Begin by installing this package through Composer. Run this command from the Terminal:, (*3)

composer require norris1z/admin_user_chat

Laravel integration

To wire this up in your Laravel project you need to add the service provider. Open app.php, and add a new item to the providers array., (*4)

'Norris1z\AdminUserChat\AdminUserChatServiceProvider::class',

Run this command from terminal, (*5)

php artisan vendor:publish

This adds admin_user_chat.php to the config.php file., (*6)

Run this command from terminal, (*7)

php artisan migrate

to run package migrations., (*8)

Usage

sendMessageToUser, sendMessageToAllUsers, sendMessageToAdministrator, sendMessageToAllAdministrators

All accept 3 parameters sender,recipient,message, (*9)

//User Controller 

public function message(Request $request,AdminUserChat $chat)
{
    $admin = User::where('is_admin',true)->first();

    //This sends a message to an administrator given the admin_id and message
    $chat->sendMessageToAdministrator(Auth::id(),$admin->id,$request->message);

     //This sends a message to all administrators given the admin_id and message
    $chat->sendMessageToAllAdministrators(Auth::id(),$admin->id,$request->message);

}

// Admin Controller

public function message(Request $request,AdminUserChat $chat)
{
    // This sends a message from the administrator to a user
    $chat->sendMessageToUser(Auth::id(),$request->user_id,$request->message);

    // This sends a message from the administrator to all users
    $chat->sendMessageToAllUsers(Auth::id(),$request->user_id,$request->message);
}

Config parameters

table which refers to the user table name, (*10)

column_name which refers to the column name in the database which checks if a user is an administrator, (*11)

admin_role which refers to the type of admin check eg. bool true / false or using numbers for roles, (*12)

user_id which refers to the user id column name in the database, (*13)

database which refers to the name of the messages table name, (*14)

The Versions

26/02 2017

dev-master

9999999-dev

A simple chat between users and an admin

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Norris Oduro

laravel chat norris1z admin_user

26/02 2017

v1.2

1.2.0.0

A simple chat between users and an admin

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Norris Oduro

laravel chat norris1z admin_user

26/02 2017

1.1

1.1.0.0

A simple chat between users and an admin

  Sources   Download

MIT

by Norris Oduro

26/02 2017

1.0

1.0.0.0

A simple chat between users and an admin

  Sources   Download

MIT

by Norris Oduro