public function participantsString($userId=null, $columns=['first_name'])
    {
        $selectString = $this->createSelectString($columns);

        $participantNames = $this->getConnection()->table($this->getUsersTable())
            ->join('participants', $this->getUsersTable() . '.id', '=', 'participants.user_id')
            ->where('participants.thread_id', $this->id)
            ->select($this->getConnection()->raw($selectString));

        if ($userId !== null) {
            $participantNames->where($this->getUsersTable() . '.id', '!=', $userId);
        }

        $userNames = $participantNames->lists($this->getUsersTable() . '.name');

        return implode(', ', $userNames);
    }
public function participantsString($userId=null, $columns=['first_name'])
    {
        $selectString = $this->createSelectString($columns);

        $participantNames = $this->getConnection()->table($this->getUsersTable())
            ->join('participants', $this->getUsersTable() . '.id', '=', 'participants.user_id')
            ->where('participants.thread_id', $this->id)
            ->select($this->getConnection()->raw($selectString));

        if ($userId !== null) {
            $participantNames->where($this->getUsersTable() . '.id', '!=', $userId);
        }

        $userNames = $participantNames->lists($this->getUsersTable() . '.name');

        return implode(', ', $userNames);
    }
public function participantsString ( $ userId = null , $ columns = [ 'first_name' ] ) { $ selectString = $ this -> createSelectString ( $ columns ) ; $ participantNames = $ this -> getConnection ( ) -> table ( $ this -> getUsersTable ( ) ) -> join ( 'participants' , $ this -> getUsersTable ( ) . '.id' , '=' , 'participants.user_id' ) -> where ( 'participants.thread_id' , $ this -> id ) -> select ( $ this -> getConnection ( ) -> raw ( $ selectString ) ) ; if ( $ userId !== null ) { $ participantNames -> where ( $ this -> getUsersTable ( ) . '.id' , '!=' , $ userId ) ; } $ userNames = $ participantNames -> lists ( $ this -> getUsersTable ( ) . '.name' ) ; return implode ( ', ' , $ userNames ) ; }
Generates a string of participant information

@param null $userId
@param array $columns
@return string
Generates a string of participant information