From f31dd4706c1b78a77935fdac3486100794116423 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 13 Sep 2020 11:59:52 -0700 Subject: [PATCH] Fix location controller searches --- .../Api/Application/Locations/LocationController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/Application/Locations/LocationController.php b/app/Http/Controllers/Api/Application/Locations/LocationController.php index 98ec30574..62ab4ea45 100644 --- a/app/Http/Controllers/Api/Application/Locations/LocationController.php +++ b/app/Http/Controllers/Api/Application/Locations/LocationController.php @@ -5,6 +5,7 @@ namespace Pterodactyl\Http\Controllers\Api\Application\Locations; use Illuminate\Http\Response; use Pterodactyl\Models\Location; use Illuminate\Http\JsonResponse; +use Spatie\QueryBuilder\QueryBuilder; use Pterodactyl\Services\Locations\LocationUpdateService; use Pterodactyl\Services\Locations\LocationCreationService; use Pterodactyl\Services\Locations\LocationDeletionService; @@ -69,7 +70,10 @@ class LocationController extends ApplicationApiController */ public function index(GetLocationsRequest $request): array { - $locations = $this->repository->setSearchTerm($request->input('search'))->paginated(50); + $locations = QueryBuilder::for(Location::query()) + ->allowedFilters(['short', 'long']) + ->allowedSorts(['id']) + ->paginate(100); return $this->fractal->collection($locations) ->transformWith($this->getTransformer(LocationTransformer::class))