mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-14 23:49:35 -06:00
- Powered by VueJS, Socket.io and Laravel Echo Server for broadcasting events. - Alpha Stage - Not ready for use!!! - https://trello.com/c/tzHOvz5h/16-shoutbox-20
70 lines
1.5 KiB
PHP
70 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
|
* The details is bundled with this project in the file LICENSE.txt.
|
|
*
|
|
* @project UNIT3D
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
|
* @author HDVinnie
|
|
*/
|
|
|
|
namespace App\Events;
|
|
|
|
use App\Chatroom;
|
|
use App\Message;
|
|
use App\User;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Broadcasting\PrivateChannel;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class MessageSent implements ShouldBroadcast
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
/**
|
|
* User that sent the message
|
|
*
|
|
* @var User
|
|
*/
|
|
public $user;
|
|
|
|
/**
|
|
* Message details
|
|
*
|
|
* @var Message
|
|
*/
|
|
public $message;
|
|
|
|
/**
|
|
* Chatroom details
|
|
*
|
|
* @var Chatroom
|
|
*/
|
|
public $chatroom;
|
|
|
|
/**
|
|
* Create a new event instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(User $user, Chatroom $chatroom, Message $message)
|
|
{
|
|
$this->user = $user;
|
|
$this->message = $message;
|
|
$this->chatroom = $chatroom;
|
|
}
|
|
|
|
/**
|
|
* Get the channels the event should broadcast on.
|
|
*
|
|
* @return Channel|array
|
|
*/
|
|
public function broadcastOn()
|
|
{
|
|
return new PrivateChannel('chatroom.' . $this->chatroom->id);
|
|
}
|
|
} |