Skip to content

Commit 3a73649

Browse files
authored
sortables (#652)
* fix: sortables * Fix styling --------- Co-authored-by: binaryk <[email protected]>
1 parent 4a6ed28 commit 3a73649

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Filters/SortCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function inRepository(RestifyRequest $request, Repository $repository): s
5252
{
5353
$collection = static::make($repository::sorts())->merge(
5454
$repository::collectRelated()->mapIntoSortable($request)
55-
);
55+
)->merge($repository::collectFieldSorts($request, $repository));
5656

5757
return $this->filter(fn (SortableFilter $filter) => $collection->contains('column', '=', $filter->column));
5858
}

src/Traits/InteractWithSearch.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ public static function collectSortables(RestifyRequest $request, Repository $rep
9393
*/
9494
public static function collectSorts(RestifyRequest $request, Repository $repository): SortCollection
9595
{
96-
$fieldSorts = static::collectFieldSorts($request, $repository);
97-
9896
$requestSorts = (new SortCollection(explode(',', $request->input('sort', ''))))
9997
->normalize()
10098
->hydrateDefinition($repository, $request)
@@ -103,7 +101,7 @@ public static function collectSorts(RestifyRequest $request, Repository $reposit
103101
->hydrateRepository($repository);
104102

105103
// Merge field sorts with request sorts and ensure it stays a SortCollection
106-
return new SortCollection($requestSorts->merge($fieldSorts));
104+
return new SortCollection($requestSorts);
107105
}
108106

109107
public static function collectFieldSorts(RestifyRequest $request, Repository $repository): Collection

0 commit comments

Comments
 (0)