Adldap\Query\Processor::processSort PHP Method

processSort() protected method

Sorts LDAP search results.
protected processSort ( array $models = [] ) : Collection
$models array
return Illuminate\Support\Collection
    protected function processSort(array $models = [])
    {
        $field = $this->builder->getSortByField();
        $flags = $this->builder->getSortByFlags();
        $direction = $this->builder->getSortByDirection();
        $desc = $direction === 'desc' ? true : false;
        return $this->newCollection($models)->sortBy(function (Model $model) use($field) {
            return $model->getAttribute($field, 0);
        }, $flags, $desc);
    }