1
0
mirror of https://github.com/flarum/core.git synced 2025-06-22 02:34:47 +02:00

Pass filter params to getApiDocument (#3037)

* Pass filter params to getApiDocument

* Set filters directly
This commit is contained in:
Ian Morland
2021-08-26 10:47:34 +01:00
committed by GitHub
parent 3db724e0b3
commit 581d9517db

View File

@ -68,12 +68,13 @@ class Index
$sort = Arr::pull($queryParams, 'sort'); $sort = Arr::pull($queryParams, 'sort');
$q = Arr::pull($queryParams, 'q'); $q = Arr::pull($queryParams, 'q');
$page = max(1, intval(Arr::pull($queryParams, 'page'))); $page = max(1, intval(Arr::pull($queryParams, 'page')));
$filters = Arr::pull($queryParams, 'filter', []);
$sortMap = $this->getSortMap(); $sortMap = $this->getSortMap();
$params = [ $params = [
'sort' => $sort && isset($sortMap[$sort]) ? $sortMap[$sort] : '', 'sort' => $sort && isset($sortMap[$sort]) ? $sortMap[$sort] : '',
'filter' => [], 'filter' => $filters,
'page' => ['offset' => ($page - 1) * 20, 'limit' => 20] 'page' => ['offset' => ($page - 1) * 20, 'limit' => 20]
]; ];