Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 48 | All time: 10,755 This week: 455![]() |
Version | License | PHP version | Categories | |||
laravel-chat 1.0.0 | The PHP License | 5 | PHP 5, Libraries, Chat |
Description | Author | |
This package implements a interactive chat module for multiple users. |
|
Simple Laravel Group Chat Module
Install using composer:
composer require php-junior/laravel-chat
Once installed, in your project's config/app.php
file replace the following entry from the providers array:
PhpJunior\LaravelChat\LaravelChatServiceProvider::class,
And
php artisan vendor:publish --provider="PhpJunior\LaravelChat\LaravelChatServiceProvider"
php artisan queue:table
php artisan queue:failed-table
php artisan migrate
Uncomment App\Providers\BroadcastServiceProvider
in the providers array of your config/app.php
configuration file
BROADCAST_DRIVER=pusher
PUSHER_APP_ID=your-pusher-app-id
PUSHER_APP_KEY=your-pusher-app-key
PUSHER_APP_SECRET=your-pusher-app-secret
PUSHER_APP_CLUSTER=your-pusher-app-cluster
Add the PhpJunior\LaravelChat\Models\UserGroup
trait to your User
model
Install the JavaScript dependencies:
npm install
npm install --save laravel-echo pusher-js vue-timeago
At the bottom of resources/assets/js/bootstrap.js
file:
import Echo from "laravel-echo"
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'your-pusher-app-key',
cluster: 'your-pusher-app-cluster',
encrypted: true
});
In resources/assets/js/app.js
file:
import VueTimeago from 'vue-timeago';
window.Bus = new Vue();
Vue.component('groups', require('./components/laravel-chat/Groups.vue'));
Vue.component('create-group', require('./components/laravel-chat/CreateGroup.vue'));
Vue.component('group-chat', require('./components/laravel-chat/GroupChat.vue'));
Vue.use(VueTimeago, {
name: 'timeago', // component name, `timeago` by default
locale: 'en-US',
locales: {
// you will need json-loader in webpack 1
'en-US': require('vue-timeago/locales/en-US.json')
}
})
Run npm run dev
to recompile your assets.
$groups = auth()->user()->groups;
$users = User::where('id', '<>', auth()->user()->id)->get();
$user = auth()->user();
return view('home', [ 'groups' => $groups , 'users' => $users , 'user' => $user ]);
In your templates
<create-group :initial-users="{{ $users }}" :current-user="{{ $user }}"></create-group>
<groups :initial-groups="{{ $groups }}" :user="{{ $user }}"></groups>
The MIT License (MIT). Please see License File for more information.
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.