/** * Handles the command execution. * * @param UploadImage $command * @return null|string * * @todo check permission */ public function handle(PostChat $command) { // check if the user can upload images, otherwise return $this->assertCan($command->actor, 'pushedx.chat.post'); $msg = ['actorId' => $command->actor->id, 'message' => $command->msg]; $id = FetchChatController::UpdateMessages($msg); $msg['id'] = $id; $pusher = $this->getPusher(); $pusher->trigger('public', 'newChat', $msg); return $command->msg; }