/** * fetch all conversation by using coversation id. * * @param int $conversationId * @param int $offset = 0 * @param int $take = 20 * @return \Nahid\Talk\Messages\Message */ public function getConversationsById($conversationId, $offset = 0, $take = 20) { $conversations = $this->conversation->getMessagesById($conversationId, $offset, $take); $collection = (object) null; if ($conversations->user_one == $this->authUserId || $conversations->user_two == $this->authUserId) { $withUser = $conversations->userone->id === $this->authUserId ? $conversations->usertwo : $conversations->userone; $collection->withUser = $withUser; $collection->messages = $conversations->messages; return $collection; } return false; }
/** * fetch all conversation by using coversation id. * * @param int $conversationId * @param int $offset = 0 * @param int $take = 20 * * @return \Nahid\Talk\Messages\Message */ public function getConversationsById($conversationId, $offset = 0, $take = 20) { $conversations = $this->conversation->getMessagesById($conversationId, $this->authUserId, $offset, $take); return $this->makeMessageCollection($conversations); }