Fix location controller searches

This commit is contained in:
Dane Everitt 2020-09-13 11:59:52 -07:00
parent a66623d8e1
commit f31dd4706c
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -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))