public function participantsUserIds($userId = null)
    {
        $users = $this->participants()->select('user_id')->get()->map(function ($participant) {
            return $participant->user_id;
        });

        if ($userId) {
            $users->push($userId);
        }

        return $users->toArray();
    }
public function participantsUserIds($userId = null)
    {
        $users = $this->participants()->select('user_id')->get()->map(function ($participant) {
            return $participant->user_id;
        });

        if ($userId) {
            $users->push($userId);
        }

        return $users->toArray();
    }
public function participantsUserIds ( $ userId = null ) { $ users = $ this -> participants ( ) -> select ( 'user_id' ) -> get ( ) -> map ( function ( $ participant ) { return $ participant -> user_id ; } ) ; if ( $ userId ) { $ users -> push ( $ userId ) ; } return $ users -> toArray ( ) ; }
Returns an array of user ids that are associated with the thread.
Deleted participants from a thread will not be returned

@param null $userId

@return array
Returns an array of user ids that are associated with the thread . Deleted participants from a thread will not be returned