Nahid\Talk\Talk::newConversation PHP Method

newConversation() protected method

make new conversation the given receiverId with currently loggedin user.
protected newConversation ( integer $receiverId ) : integer
$receiverId integer
return integer
    protected function newConversation($receiverId)
    {
        $conversationId = $this->isConversationExists($receiverId);
        $user = $this->getSerializeUser($this->authUserId, $receiverId);
        if ($conversationId === false) {
            $conversation = $this->conversation->create(['user_one' => $user['one'], 'user_two' => $user['two'], 'status' => 1]);
            if ($conversation) {
                return $conversation->id;
            }
        }
        return $conversationId;
    }