public function process($results)
    {
        // Normalize entries. Get entries returns false on failure.
        // We'll always want an array in this situation.
        $entries = $this->connection->getEntries($results) ?: [];

        if ($this->builder->isRaw()) {
            // If the builder is asking for a raw
            // LDAP result, we can return here.
            return $entries;
        }

        $models = [];

        if (Arr::has($entries, 'count')) {
            for ($i = 0; $i < $entries['count']; $i++) {
                // We'll go through each entry and construct a new
                // model instance with the raw LDAP attributes.
                $models[] = $this->newLdapEntry($entries[$i]);
            }
        }

        // If the query contains paginated results, we'll return them here.
        if ($this->builder->isPaginated()) {
            return $models;
        }

        // If the query is requested to be sorted, we'll perform
        // that here and return the resulting collection.
        if ($this->builder->isSorted()) {
            return $this->processSort($models);
        }

        // Otherwise, we'll return a regular unsorted collection.
        return $this->newCollection($models);
    }
public function process($results)
    {
        // Normalize entries. Get entries returns false on failure.
        // We'll always want an array in this situation.
        $entries = $this->connection->getEntries($results) ?: [];

        if ($this->builder->isRaw()) {
            // If the builder is asking for a raw
            // LDAP result, we can return here.
            return $entries;
        }

        $models = [];

        if (Arr::has($entries, 'count')) {
            for ($i = 0; $i < $entries['count']; $i++) {
                // We'll go through each entry and construct a new
                // model instance with the raw LDAP attributes.
                $models[] = $this->newLdapEntry($entries[$i]);
            }
        }

        // If the query contains paginated results, we'll return them here.
        if ($this->builder->isPaginated()) {
            return $models;
        }

        // If the query is requested to be sorted, we'll perform
        // that here and return the resulting collection.
        if ($this->builder->isSorted()) {
            return $this->processSort($models);
        }

        // Otherwise, we'll return a regular unsorted collection.
        return $this->newCollection($models);
    }
public function process ( $ results ) { // Normalize entries. Get entries returns false on failure. // We'll always want an array in this situation. $ entries = $ this -> connection -> getEntries ( $ results ) ? : [ ] ; if ( $ this -> builder -> isRaw ( ) ) { // If the builder is asking for a raw // LDAP result, we can return here. return $ entries ; } $ models = [ ] ; if ( Arr :: has ( $ entries , 'count' ) ) { for ( $ i = 0 ; $ i < $ entries [ 'count' ] ; $ i ++ ) { // We'll go through each entry and construct a new // model instance with the raw LDAP attributes. $ models [ ] = $ this -> newLdapEntry ( $ entries [ $ i ] ) ; } } // If the query contains paginated results, we'll return them here. if ( $ this -> builder -> isPaginated ( ) ) { return $ models ; } // If the query is requested to be sorted, we'll perform // that here and return the resulting collection. if ( $ this -> builder -> isSorted ( ) ) { return $ this -> processSort ( $ models ) ; } // Otherwise, we'll return a regular unsorted collection. return $ this -> newCollection ( $ models ) ; }
Processes LDAP search results and constructs their model instances.

@param resource $results

@return Collection|array
Processes LDAP search results and constructs their model instances .