public function getMessagesAllById($conversationId, $offset, $take) { return $this->with(['messages' => function ($q) use($offset, $take) { return $q->offset($offset)->take($take); }, 'userone', 'usertwo'])->find($conversationId); }
/** * fetch all conversation with soft deleted messages by using coversation id. * * @param int $conversationId * @param int $offset = 0 * @param int $take = 20 * * @return \Nahid\Talk\Messages\Message */ public function getConversationsAllById($conversationId, $offset = 0, $take = 20) { $conversations = $this->conversation->getMessagesAllById($conversationId, $offset, $take); return $this->makeMessageCollection($conversations); }