public function addParticipants($userIds)
    {
        if (is_array($userIds)) {
            foreach ($userIds as $id) {
                $this->users()->attach($id);
            }
        } else {
            $this->users()->attach($userIds);
        }

        if (Chat::makeThreeOrMoreUsersPublic() && $this->fresh()->users->count() > 2) {
            $this->private = false;
            $this->save();
        }

        return $this;
    }
public function addParticipants($userIds)
    {
        if (is_array($userIds)) {
            foreach ($userIds as $id) {
                $this->users()->attach($id);
            }
        } else {
            $this->users()->attach($userIds);
        }

        if (Chat::makeThreeOrMoreUsersPublic() && $this->fresh()->users->count() > 2) {
            $this->private = false;
            $this->save();
        }

        return $this;
    }
public function addParticipants ( $ userIds ) { if ( is_array ( $ userIds ) ) { foreach ( $ userIds as $ id ) { $ this -> users ( ) -> attach ( $ id ) ; } } else { $ this -> users ( ) -> attach ( $ userIds ) ; } if ( Chat :: makeThreeOrMoreUsersPublic ( ) && $ this -> fresh ( ) -> users -> count ( ) > 2 ) { $ this -> private = false ; $ this -> save ( ) ; } return $ this ; }
Add user to conversation.

@param int $userId

@return void
Add user to conversation .