Skip to content

Commit

Permalink
fix(controller): correct the method to sort the index
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Sep 16, 2023
1 parent 0b02d68 commit 9614daa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Controllers/BaseOwnedResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function index()
$scoped_model = $model->filterList($scoped_model, $filter);

$sort = $request->getVar("sort") ?? [];
$scoped_model = $model->filterList($scoped_model, $sort);
$scoped_model = $model->sortList($scoped_model, $sort);

$page = $request->getVar("page") ?? [];
$scoped_model = $model->paginateList($scoped_model, $page);
Expand Down
2 changes: 1 addition & 1 deletion app/Models/BaseResourceModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function paginateList(BaseResourceModel $query_builder, array $options) {
$offset = $options["offset"] ?? 0;
$limit = min($options["limit"] ?? 100, 100);

return $query_builder->limit($limit, $offset);
return $query_builder->limit($limit)->offset($offset);
}

public function isOwnedBy(User $user, string $search_mode, int $resource_id): bool {
Expand Down

0 comments on commit 9614daa

Please sign in to comment.