public function participantsString($userId = null, $columns = ['name'])
    {
        $participantsTable = Models::table('participants');
        $usersTable = Models::table('users');
        $userPrimaryKey = Models::user()->getKeyName();

        $selectString = $this->createSelectString($columns);

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

        if ($userId !== null) {
            $participantNames->where($usersTable . '.' . $userPrimaryKey, '!=', $userId);
        }

        return $participantNames->implode('name', ', ');
    }
public function participantsString($userId = null, $columns = ['name'])
    {
        $participantsTable = Models::table('participants');
        $usersTable = Models::table('users');
        $userPrimaryKey = Models::user()->getKeyName();

        $selectString = $this->createSelectString($columns);

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

        if ($userId !== null) {
            $participantNames->where($usersTable . '.' . $userPrimaryKey, '!=', $userId);
        }

        return $participantNames->implode('name', ', ');
    }
public function participantsString ( $ userId = null , $ columns = [ 'name' ] ) { $ participantsTable = Models :: table ( 'participants' ) ; $ usersTable = Models :: table ( 'users' ) ; $ userPrimaryKey = Models :: user ( ) -> getKeyName ( ) ; $ selectString = $ this -> createSelectString ( $ columns ) ; $ participantNames = $ this -> getConnection ( ) -> table ( $ usersTable ) -> join ( $ participantsTable , $ usersTable . '.' . $ userPrimaryKey , '=' , $ participantsTable . '.user_id' ) -> where ( $ participantsTable . '.thread_id' , $ this -> id ) -> select ( $ this -> getConnection ( ) -> raw ( $ selectString ) ) ; if ( $ userId !== null ) { $ participantNames -> where ( $ usersTable . '.' . $ userPrimaryKey , '!=' , $ userId ) ; } return $ participantNames -> implode ( 'name' , ', ' ) ; }
Generates a string of participant information.

@param null|int $userId
@param array $columns

@return string
Generates a string of participant information .