/** * Store a new instance of a message in the conversation * * @param Conversation $conversation * @param Request $request * @return Response */ public function store(Conversation $conversation, Request $request) { $message = Message::create(['body' => config('confer.enable_emoji') ? confer_convert_emoji_to_shortcodes(strip_tags($request->input('body'))) : strip_tags($request->input('body')), 'conversation_id' => $conversation->id, 'sender_id' => $this->user->id, 'type' => 'user_message']); $this->dispatch(new MessageWasSent($message)); return $message->load('sender'); }
private function makeLeftMessage() { $message = Message::create(['conversation_id' => $this->conversation->id, 'body' => '<strong>' . $this->leaver->name . '</strong> left the conversation', 'sender_id' => $this->leaver->id, 'type' => 'conversation_message']); $this->dispatch(new MessageWasSent($message)); }
private function makeNameSetMessage() { $message = Message::create(['conversation_id' => $this->conversation->id, 'body' => $this->inviter->name . ' set the name to <strong>' . $this->conversation->name . '</strong>', 'sender_id' => $this->inviter->id, 'type' => 'conversation_message']); $this->dispatch(new MessageWasSent($message)); }