queryParameters->filter(); $sort = $this->queryParameters->sortFields(); $pagination = $this->filtersPagination($this->queryParameters->page()); $needsAll = $this->validateParams('account', $sort); $query = $this->userGroup->accounts(); if (!$needsAll) { $query = $this->addPagination($query, $pagination); } $query = $this->addSortParams($query, $sort); $query = $this->addFilterParams('account', $query, $filters); $collection = $query->get(['accounts.*']); // enrich data $enrichment = new AccountEnrichment(); $collection = $enrichment->enrich($collection); // add filters after the query // add sort after the query return $this->sortCollection($collection, $sort); // var_dump($filters->value('name')); // exit; } }