diff --git a/app/Http/Controllers/Api/Application/ApplicationApiController.php b/app/Http/Controllers/Api/Application/ApplicationApiController.php index 941be062..5f9b23d8 100644 --- a/app/Http/Controllers/Api/Application/ApplicationApiController.php +++ b/app/Http/Controllers/Api/Application/ApplicationApiController.php @@ -7,6 +7,7 @@ use Webmozart\Assert\Assert; use Illuminate\Http\Response; use Illuminate\Support\Collection; use Illuminate\Container\Container; +use Illuminate\Support\Facades\Log; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Extensions\Spatie\Fractalistic\Fractal; use Pterodactyl\Transformers\Api\Application\BaseTransformer; @@ -45,9 +46,6 @@ abstract class ApplicationApiController extends Controller /** * Perform dependency injection of certain classes needed for core functionality * without littering the constructors of classes that extend this abstract. - * - * @param \Pterodactyl\Extensions\Spatie\Fractalistic\Fractal $fractal - * @param \Illuminate\Http\Request $request */ public function loadDependencies(Fractal $fractal, Request $request) { @@ -58,17 +56,18 @@ abstract class ApplicationApiController extends Controller /** * Return an instance of an application transformer. * - * @param string $abstract - * * @return \Pterodactyl\Transformers\Api\Application\BaseTransformer + * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function getTransformer(string $abstract) { /** @var \Pterodactyl\Transformers\Api\Application\BaseTransformer $transformer */ $transformer = Container::getInstance()->make($abstract); - $transformer->setRootAdmin($this->request->user()->root_admin); + + $apiKey = $this->request->attributes->get('api_key'); $transformer->setKey($this->request->attributes->get('api_key')); + $transformer->setRootAdmin($this->request->user()->root_admin); Assert::isInstanceOf($transformer, BaseTransformer::class); @@ -77,8 +76,6 @@ abstract class ApplicationApiController extends Controller /** * Return a HTTP/204 response for the API. - * - * @return \Illuminate\Http\Response */ protected function returnNoContent(): Response { diff --git a/app/Http/Middleware/Api/AuthenticateKey.php b/app/Http/Middleware/Api/AuthenticateKey.php index db469bc5..1a9ff2e5 100644 --- a/app/Http/Middleware/Api/AuthenticateKey.php +++ b/app/Http/Middleware/Api/AuthenticateKey.php @@ -16,20 +16,9 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; class AuthenticateKey { - /** - * @var \Illuminate\Auth\AuthManager - */ - private $auth; - - /** - * @var \Illuminate\Contracts\Encryption\Encrypter - */ - private $encrypter; - - /** - * @var \Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface - */ - private $repository; + private AuthManager $auth; + private Encrypter $encrypter; + private ApiKeyRepositoryInterface $repository; /** * AuthenticateKey constructor. diff --git a/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php index 9fab4e2c..1729d720 100644 --- a/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/DeleteAllocationRequest.php @@ -9,15 +9,8 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteAllocationRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_ALLOCATIONS; - - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected string $resource = AdminAcl::RESOURCE_ALLOCATIONS; + protected int $permission = AdminAcl::WRITE; /** * Determine if the requested allocation exists and belongs to the node that diff --git a/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php b/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php index 524e201e..b811fe52 100644 --- a/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/GetAllocationsRequest.php @@ -8,15 +8,8 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetAllocationsRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_ALLOCATIONS; - - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected string $resource = AdminAcl::RESOURCE_ALLOCATIONS; + protected int $permission = AdminAcl::READ; /** * Determine if the node that we are requesting the allocations diff --git a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php index d1f5415a..5bd79970 100644 --- a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php @@ -7,15 +7,8 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreAllocationRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_ALLOCATIONS; - - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected string $resource = AdminAcl::RESOURCE_ALLOCATIONS; + protected int $permission = AdminAcl::WRITE; public function rules(): array { @@ -27,10 +20,7 @@ class StoreAllocationRequest extends ApplicationApiRequest ]; } - /** - * @return array - */ - public function validated() + public function validated(): array { $data = parent::validated(); diff --git a/app/Http/Requests/Api/Application/ApplicationApiRequest.php b/app/Http/Requests/Api/Application/ApplicationApiRequest.php index 6bb3bed3..143549db 100644 --- a/app/Http/Requests/Api/Application/ApplicationApiRequest.php +++ b/app/Http/Requests/Api/Application/ApplicationApiRequest.php @@ -15,10 +15,8 @@ abstract class ApplicationApiRequest extends FormRequest /** * Tracks if the request has been validated internally or not to avoid * making duplicate validation calls. - * - * @var bool */ - private $hasValidated = false; + private bool $hasValidated = false; /** * The resource that should be checked when performing the authorization @@ -26,7 +24,7 @@ abstract class ApplicationApiRequest extends FormRequest * * @var string|null */ - protected $resource; + protected string $resource; /** * The permission level that a given API key should have for accessing @@ -34,7 +32,7 @@ abstract class ApplicationApiRequest extends FormRequest * * @var int */ - protected $permission = AdminAcl::NONE; + protected int $permission = AdminAcl::NONE; /** * Determine if the current user is authorized to perform @@ -48,7 +46,7 @@ abstract class ApplicationApiRequest extends FormRequest throw new PterodactylException('An ACL resource must be defined on API requests.'); } - if (! is_null($this->user())) { + if ($this->key()->key_type === ApiKey::TYPE_ACCOUNT) { return $this->user()->root_admin; } diff --git a/app/Http/Requests/Api/Application/Databases/DatabaseNodesRequest.php b/app/Http/Requests/Api/Application/Databases/DatabaseNodesRequest.php index 7bd16d0e..6227fec3 100644 --- a/app/Http/Requests/Api/Application/Databases/DatabaseNodesRequest.php +++ b/app/Http/Requests/Api/Application/Databases/DatabaseNodesRequest.php @@ -7,23 +7,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DatabaseNodesRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_DATABASE_HOSTS; + protected string $resource = AdminAcl::RESOURCE_DATABASE_HOSTS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? ['nodes' => 'required|exists:nodes,id']; diff --git a/app/Http/Requests/Api/Application/Databases/DeleteDatabaseRequest.php b/app/Http/Requests/Api/Application/Databases/DeleteDatabaseRequest.php index 3281f876..0efd8e5d 100644 --- a/app/Http/Requests/Api/Application/Databases/DeleteDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Databases/DeleteDatabaseRequest.php @@ -8,21 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteDatabaseRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_DATABASE_HOSTS; + protected string $resource = AdminAcl::RESOURCE_DATABASE_HOSTS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * Determine if the requested database exists on the Panel. - * - * @return bool - */ public function resourceExists(): bool { $databaseHost = $this->route()->parameter('databaseHost'); diff --git a/app/Http/Requests/Api/Application/Databases/GetDatabaseRequest.php b/app/Http/Requests/Api/Application/Databases/GetDatabaseRequest.php index 3e291234..166064f9 100644 --- a/app/Http/Requests/Api/Application/Databases/GetDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Databases/GetDatabaseRequest.php @@ -6,11 +6,6 @@ use Pterodactyl\Models\DatabaseHost; class GetDatabaseRequest extends GetDatabasesRequest { - /** - * Determine if the requested database exists on the Panel. - * - * @return bool - */ public function resourceExists(): bool { $databaseHost = $this->route()->parameter('databaseHost'); diff --git a/app/Http/Requests/Api/Application/Databases/GetDatabasesRequest.php b/app/Http/Requests/Api/Application/Databases/GetDatabasesRequest.php index 7de511b3..feb2c8ad 100644 --- a/app/Http/Requests/Api/Application/Databases/GetDatabasesRequest.php +++ b/app/Http/Requests/Api/Application/Databases/GetDatabasesRequest.php @@ -7,13 +7,6 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetDatabasesRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = Acl::RESOURCE_DATABASE_HOSTS; - - /** - * @var int - */ - protected $permission = Acl::READ; + protected string $resource = Acl::RESOURCE_DATABASE_HOSTS; + protected int $permission = Acl::READ; } diff --git a/app/Http/Requests/Api/Application/Databases/StoreDatabaseRequest.php b/app/Http/Requests/Api/Application/Databases/StoreDatabaseRequest.php index ce98c1cc..600a93ef 100644 --- a/app/Http/Requests/Api/Application/Databases/StoreDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Databases/StoreDatabaseRequest.php @@ -8,23 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreDatabaseRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_DATABASE_HOSTS; + protected string $resource = AdminAcl::RESOURCE_DATABASE_HOSTS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? DatabaseHost::getRules(); diff --git a/app/Http/Requests/Api/Application/Databases/UpdateDatabaseRequest.php b/app/Http/Requests/Api/Application/Databases/UpdateDatabaseRequest.php index 7561713c..47671900 100644 --- a/app/Http/Requests/Api/Application/Databases/UpdateDatabaseRequest.php +++ b/app/Http/Requests/Api/Application/Databases/UpdateDatabaseRequest.php @@ -6,13 +6,6 @@ use Pterodactyl\Models\DatabaseHost; class UpdateDatabaseRequest extends StoreDatabaseRequest { - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? DatabaseHost::getRulesForUpdate($this->route()->parameter('databaseHost')->id); diff --git a/app/Http/Requests/Api/Application/Eggs/DeleteEggRequest.php b/app/Http/Requests/Api/Application/Eggs/DeleteEggRequest.php index 2a774d5c..a3ce1f2c 100644 --- a/app/Http/Requests/Api/Application/Eggs/DeleteEggRequest.php +++ b/app/Http/Requests/Api/Application/Eggs/DeleteEggRequest.php @@ -8,19 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteEggRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_EGGS; + protected string $resource = AdminAcl::RESOURCE_EGGS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * Determine if the requested egg exists for the selected nest. - */ public function resourceExists(): bool { $egg = $this->route()->parameter('egg'); diff --git a/app/Http/Requests/Api/Application/Eggs/GetEggRequest.php b/app/Http/Requests/Api/Application/Eggs/GetEggRequest.php index 9405cb80..a01d6db3 100644 --- a/app/Http/Requests/Api/Application/Eggs/GetEggRequest.php +++ b/app/Http/Requests/Api/Application/Eggs/GetEggRequest.php @@ -6,11 +6,6 @@ use Pterodactyl\Models\Egg; class GetEggRequest extends GetEggsRequest { - /** - * Determine if the requested egg exists on the Panel. - * - * @return bool - */ public function resourceExists(): bool { $egg = $this->route()->parameter('egg'); diff --git a/app/Http/Requests/Api/Application/Eggs/GetEggsRequest.php b/app/Http/Requests/Api/Application/Eggs/GetEggsRequest.php index 8323a369..fb2015a3 100644 --- a/app/Http/Requests/Api/Application/Eggs/GetEggsRequest.php +++ b/app/Http/Requests/Api/Application/Eggs/GetEggsRequest.php @@ -7,13 +7,6 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetEggsRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_EGGS; - - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected string $resource = AdminAcl::RESOURCE_EGGS; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Eggs/StoreEggRequest.php b/app/Http/Requests/Api/Application/Eggs/StoreEggRequest.php index 4e43bae7..7b3cad7e 100644 --- a/app/Http/Requests/Api/Application/Eggs/StoreEggRequest.php +++ b/app/Http/Requests/Api/Application/Eggs/StoreEggRequest.php @@ -8,23 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreEggRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_EGGS; + protected string $resource = AdminAcl::RESOURCE_EGGS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? Egg::getRules(); diff --git a/app/Http/Requests/Api/Application/Eggs/UpdateEggRequest.php b/app/Http/Requests/Api/Application/Eggs/UpdateEggRequest.php index ea35d006..0ce5db57 100644 --- a/app/Http/Requests/Api/Application/Eggs/UpdateEggRequest.php +++ b/app/Http/Requests/Api/Application/Eggs/UpdateEggRequest.php @@ -6,13 +6,6 @@ use Pterodactyl\Models\Egg; class UpdateEggRequest extends StoreEggRequest { - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? Egg::getRulesForUpdate($this->route()->parameter('egg')->id); diff --git a/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php b/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php index ac58314f..ba97ec19 100644 --- a/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/DeleteLocationRequest.php @@ -8,19 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteLocationRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_LOCATIONS; + protected string $resource = AdminAcl::RESOURCE_LOCATIONS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * Determine if the requested location exists on the Panel. - */ public function resourceExists(): bool { $location = $this->route()->parameter('location'); diff --git a/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php b/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php index f7c10e0c..59c3605d 100644 --- a/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/GetLocationRequest.php @@ -6,9 +6,6 @@ use Pterodactyl\Models\Location; class GetLocationRequest extends GetLocationsRequest { - /** - * Determine if the requested location exists on the Panel. - */ public function resourceExists(): bool { $location = $this->route()->parameter('location'); diff --git a/app/Http/Requests/Api/Application/Locations/GetLocationsRequest.php b/app/Http/Requests/Api/Application/Locations/GetLocationsRequest.php index 5edf0046..1a79846e 100644 --- a/app/Http/Requests/Api/Application/Locations/GetLocationsRequest.php +++ b/app/Http/Requests/Api/Application/Locations/GetLocationsRequest.php @@ -7,13 +7,6 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetLocationsRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_LOCATIONS; - - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected string $resource = AdminAcl::RESOURCE_LOCATIONS; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php b/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php index c5586ead..08f9a1da 100644 --- a/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/StoreLocationRequest.php @@ -8,19 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreLocationRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_LOCATIONS; + protected string $resource = AdminAcl::RESOURCE_LOCATIONS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * Rules to validate the request against. - */ public function rules(): array { return collect(Location::getRules())->only([ @@ -29,12 +19,7 @@ class StoreLocationRequest extends ApplicationApiRequest ])->toArray(); } - /** - * Rename fields to be more clear in error messages. - * - * @return array - */ - public function attributes() + public function attributes(): array { return [ 'long' => 'Location Description', diff --git a/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php b/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php index c775e2b1..6229870b 100644 --- a/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php +++ b/app/Http/Requests/Api/Application/Locations/UpdateLocationRequest.php @@ -6,9 +6,6 @@ use Pterodactyl\Models\Location; class UpdateLocationRequest extends StoreLocationRequest { - /** - * Determine if the requested location exists on the Panel. - */ public function resourceExists(): bool { $location = $this->route()->parameter('location'); @@ -16,9 +13,6 @@ class UpdateLocationRequest extends StoreLocationRequest return $location instanceof Location && $location->exists; } - /** - * Rules to validate this request against. - */ public function rules(): array { $locationId = $this->route()->parameter('location')->id; diff --git a/app/Http/Requests/Api/Application/Mounts/DeleteMountRequest.php b/app/Http/Requests/Api/Application/Mounts/DeleteMountRequest.php index 232f3ea9..0bef09b6 100644 --- a/app/Http/Requests/Api/Application/Mounts/DeleteMountRequest.php +++ b/app/Http/Requests/Api/Application/Mounts/DeleteMountRequest.php @@ -8,21 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteMountRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_MOUNTS; + protected string $resource = AdminAcl::RESOURCE_MOUNTS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * Determine if the requested mount exists on the Panel. - * - * @return bool - */ public function resourceExists(): bool { $mount = $this->route()->parameter('mount'); diff --git a/app/Http/Requests/Api/Application/Mounts/GetMountRequest.php b/app/Http/Requests/Api/Application/Mounts/GetMountRequest.php index d0bad175..e6fa96b2 100644 --- a/app/Http/Requests/Api/Application/Mounts/GetMountRequest.php +++ b/app/Http/Requests/Api/Application/Mounts/GetMountRequest.php @@ -6,11 +6,6 @@ use Pterodactyl\Models\Mount; class GetMountRequest extends GetMountsRequest { - /** - * Determine if the requested mount exists on the Panel. - * - * @return bool - */ public function resourceExists(): bool { $mount = $this->route()->parameter('mount'); diff --git a/app/Http/Requests/Api/Application/Mounts/GetMountsRequest.php b/app/Http/Requests/Api/Application/Mounts/GetMountsRequest.php index eaee2206..c5626862 100644 --- a/app/Http/Requests/Api/Application/Mounts/GetMountsRequest.php +++ b/app/Http/Requests/Api/Application/Mounts/GetMountsRequest.php @@ -7,13 +7,6 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetMountsRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = Acl::RESOURCE_MOUNTS; - - /** - * @var int - */ - protected $permission = Acl::READ; + protected string $resource = Acl::RESOURCE_MOUNTS; + protected int $permission = Acl::READ; } diff --git a/app/Http/Requests/Api/Application/Mounts/MountEggsRequest.php b/app/Http/Requests/Api/Application/Mounts/MountEggsRequest.php index 297ec46c..504247a2 100644 --- a/app/Http/Requests/Api/Application/Mounts/MountEggsRequest.php +++ b/app/Http/Requests/Api/Application/Mounts/MountEggsRequest.php @@ -7,23 +7,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class MountEggsRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_MOUNTS; + protected string $resource = AdminAcl::RESOURCE_MOUNTS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? ['eggs' => 'required|exists:eggs,id']; diff --git a/app/Http/Requests/Api/Application/Mounts/MountNodesRequest.php b/app/Http/Requests/Api/Application/Mounts/MountNodesRequest.php index e14d816c..5922677e 100644 --- a/app/Http/Requests/Api/Application/Mounts/MountNodesRequest.php +++ b/app/Http/Requests/Api/Application/Mounts/MountNodesRequest.php @@ -7,23 +7,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class MountNodesRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_MOUNTS; + protected string $resource = AdminAcl::RESOURCE_MOUNTS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? ['nodes' => 'required|exists:nodes,id']; diff --git a/app/Http/Requests/Api/Application/Mounts/StoreMountRequest.php b/app/Http/Requests/Api/Application/Mounts/StoreMountRequest.php index b75b7684..e6e4f423 100644 --- a/app/Http/Requests/Api/Application/Mounts/StoreMountRequest.php +++ b/app/Http/Requests/Api/Application/Mounts/StoreMountRequest.php @@ -8,23 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreMountRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_MOUNTS; + protected string $resource = AdminAcl::RESOURCE_MOUNTS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? Mount::getRules(); diff --git a/app/Http/Requests/Api/Application/Mounts/UpdateMountRequest.php b/app/Http/Requests/Api/Application/Mounts/UpdateMountRequest.php index 7a3aa3c5..b9b51b12 100644 --- a/app/Http/Requests/Api/Application/Mounts/UpdateMountRequest.php +++ b/app/Http/Requests/Api/Application/Mounts/UpdateMountRequest.php @@ -6,13 +6,6 @@ use Pterodactyl\Models\Mount; class UpdateMountRequest extends StoreMountRequest { - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? Mount::getRulesForUpdate($this->route()->parameter('mount')->id); diff --git a/app/Http/Requests/Api/Application/Nests/DeleteNestRequest.php b/app/Http/Requests/Api/Application/Nests/DeleteNestRequest.php index 16843389..92fbde61 100644 --- a/app/Http/Requests/Api/Application/Nests/DeleteNestRequest.php +++ b/app/Http/Requests/Api/Application/Nests/DeleteNestRequest.php @@ -8,21 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteNestRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_NESTS; + protected string $resource = AdminAcl::RESOURCE_NESTS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * Determine if the requested nest exists on the Panel. - * - * @return bool - */ public function resourceExists(): bool { $nest = $this->route()->parameter('nest'); diff --git a/app/Http/Requests/Api/Application/Nests/GetNestRequest.php b/app/Http/Requests/Api/Application/Nests/GetNestRequest.php index db6be4f8..370d7eab 100644 --- a/app/Http/Requests/Api/Application/Nests/GetNestRequest.php +++ b/app/Http/Requests/Api/Application/Nests/GetNestRequest.php @@ -6,11 +6,6 @@ use Pterodactyl\Models\Nest; class GetNestRequest extends GetNestsRequest { - /** - * Determine if the requested nest exists on the Panel. - * - * @return bool - */ public function resourceExists(): bool { $nest = $this->route()->parameter('nest'); diff --git a/app/Http/Requests/Api/Application/Nests/GetNestsRequest.php b/app/Http/Requests/Api/Application/Nests/GetNestsRequest.php index b90c4574..ec04e8ed 100644 --- a/app/Http/Requests/Api/Application/Nests/GetNestsRequest.php +++ b/app/Http/Requests/Api/Application/Nests/GetNestsRequest.php @@ -7,13 +7,6 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetNestsRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_NESTS; - - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected string $resource = AdminAcl::RESOURCE_NESTS; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Nests/StoreNestRequest.php b/app/Http/Requests/Api/Application/Nests/StoreNestRequest.php index 5168dcfc..5be1f4be 100644 --- a/app/Http/Requests/Api/Application/Nests/StoreNestRequest.php +++ b/app/Http/Requests/Api/Application/Nests/StoreNestRequest.php @@ -8,23 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreNestRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_NESTS; + protected string $resource = AdminAcl::RESOURCE_NESTS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? Nest::getRules(); diff --git a/app/Http/Requests/Api/Application/Nests/UpdateNestRequest.php b/app/Http/Requests/Api/Application/Nests/UpdateNestRequest.php index 7f425ddf..1c7aaec8 100644 --- a/app/Http/Requests/Api/Application/Nests/UpdateNestRequest.php +++ b/app/Http/Requests/Api/Application/Nests/UpdateNestRequest.php @@ -6,13 +6,6 @@ use Pterodactyl\Models\Nest; class UpdateNestRequest extends StoreNestRequest { - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? Nest::getRulesForUpdate($this->route()->parameter('nest')->id); diff --git a/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php index eb1d1d9a..f9806ecb 100644 --- a/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/DeleteNodeRequest.php @@ -8,20 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteNodeRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_NODES; + protected string $resource = AdminAcl::RESOURCE_NODES; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * Determine if the node being requested for editing exists - * on the Panel before validating the data. - */ public function resourceExists(): bool { $node = $this->route()->parameter('node'); diff --git a/app/Http/Requests/Api/Application/Nodes/GetDeployableNodesRequest.php b/app/Http/Requests/Api/Application/Nodes/GetDeployableNodesRequest.php index 0eae1400..fd077ecd 100644 --- a/app/Http/Requests/Api/Application/Nodes/GetDeployableNodesRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/GetDeployableNodesRequest.php @@ -4,9 +4,6 @@ namespace Pterodactyl\Http\Requests\Api\Application\Nodes; class GetDeployableNodesRequest extends GetNodesRequest { - /** - * @return string[] - */ public function rules(): array { return [ diff --git a/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php index bbb15703..d8098a0d 100644 --- a/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/GetNodeRequest.php @@ -6,9 +6,6 @@ use Pterodactyl\Models\Node; class GetNodeRequest extends GetNodesRequest { - /** - * Determine if the requested node exists on the Panel. - */ public function resourceExists(): bool { $node = $this->route()->parameter('node'); diff --git a/app/Http/Requests/Api/Application/Nodes/GetNodesRequest.php b/app/Http/Requests/Api/Application/Nodes/GetNodesRequest.php index fc5f5a38..4df2c852 100644 --- a/app/Http/Requests/Api/Application/Nodes/GetNodesRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/GetNodesRequest.php @@ -7,13 +7,6 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetNodesRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_NODES; - - /** - * @var int - */ - protected $permission = AdminAcl::READ; + protected string $resource = AdminAcl::RESOURCE_NODES; + protected int $permission = AdminAcl::READ; } diff --git a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php index 8c05c5a3..e196ba10 100644 --- a/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/StoreNodeRequest.php @@ -8,15 +8,8 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreNodeRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_NODES; - - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; + protected string $resource = AdminAcl::RESOURCE_NODES; + protected int $permission = AdminAcl::WRITE; /** * Validation rules to apply to this request. diff --git a/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php b/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php index 2da2d406..05daebc2 100644 --- a/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php +++ b/app/Http/Requests/Api/Application/Nodes/UpdateNodeRequest.php @@ -6,14 +6,8 @@ use Pterodactyl\Models\Node; class UpdateNodeRequest extends StoreNodeRequest { - /** - * Apply validation rules to this request. Uses the parent class rules() - * function but passes in the rules for updating rather than creating. - */ public function rules(array $rules = null): array { - $nodeId = $this->getModel(Node::class)->id; - - return parent::rules(Node::getRulesForUpdate($nodeId)); + return parent::rules($rules ?? Node::getRulesForUpdate($this->route()->parameter('node')->id)); } } diff --git a/app/Http/Requests/Api/Application/Roles/DeleteRoleRequest.php b/app/Http/Requests/Api/Application/Roles/DeleteRoleRequest.php index 94c73d0a..02d042ac 100644 --- a/app/Http/Requests/Api/Application/Roles/DeleteRoleRequest.php +++ b/app/Http/Requests/Api/Application/Roles/DeleteRoleRequest.php @@ -8,21 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteRoleRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_ROLES; + protected string $resource = AdminAcl::RESOURCE_ROLES; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * Determine if the requested role exists on the Panel. - * - * @return bool - */ public function resourceExists(): bool { $role = $this->route()->parameter('role'); diff --git a/app/Http/Requests/Api/Application/Roles/GetRoleRequest.php b/app/Http/Requests/Api/Application/Roles/GetRoleRequest.php index cd583c85..287323ed 100644 --- a/app/Http/Requests/Api/Application/Roles/GetRoleRequest.php +++ b/app/Http/Requests/Api/Application/Roles/GetRoleRequest.php @@ -6,11 +6,6 @@ use Pterodactyl\Models\AdminRole; class GetRoleRequest extends GetRolesRequest { - /** - * Determine if the requested role exists on the Panel. - * - * @return bool - */ public function resourceExists(): bool { $role = $this->route()->parameter('role'); diff --git a/app/Http/Requests/Api/Application/Roles/GetRolesRequest.php b/app/Http/Requests/Api/Application/Roles/GetRolesRequest.php index 567765da..3384b3ef 100644 --- a/app/Http/Requests/Api/Application/Roles/GetRolesRequest.php +++ b/app/Http/Requests/Api/Application/Roles/GetRolesRequest.php @@ -7,13 +7,6 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetRolesRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = Acl::RESOURCE_ROLES; - - /** - * @var int - */ - protected $permission = Acl::READ; + protected string $resource = Acl::RESOURCE_ROLES; + protected int $permission = Acl::READ; } diff --git a/app/Http/Requests/Api/Application/Roles/StoreRoleRequest.php b/app/Http/Requests/Api/Application/Roles/StoreRoleRequest.php index bb57fc51..7e1b6521 100644 --- a/app/Http/Requests/Api/Application/Roles/StoreRoleRequest.php +++ b/app/Http/Requests/Api/Application/Roles/StoreRoleRequest.php @@ -8,23 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreRoleRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_ROLES; + protected string $resource = AdminAcl::RESOURCE_ROLES; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? AdminRole::getRules(); diff --git a/app/Http/Requests/Api/Application/Roles/UpdateRoleRequest.php b/app/Http/Requests/Api/Application/Roles/UpdateRoleRequest.php index 11ec03eb..de3221ab 100644 --- a/app/Http/Requests/Api/Application/Roles/UpdateRoleRequest.php +++ b/app/Http/Requests/Api/Application/Roles/UpdateRoleRequest.php @@ -6,13 +6,6 @@ use Pterodactyl\Models\AdminRole; class UpdateRoleRequest extends StoreRoleRequest { - /** - * ? - * - * @param array|null $rules - * - * @return array - */ public function rules(array $rules = null): array { return $rules ?? AdminRole::getRulesForUpdate($this->route()->parameter('role')->id); diff --git a/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php b/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php index 56c028a6..18527761 100644 --- a/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/DeleteUserRequest.php @@ -8,19 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class DeleteUserRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_USERS; + protected string $resource = AdminAcl::RESOURCE_USERS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * Determine if the requested user exists on the Panel. - */ public function resourceExists(): bool { $user = $this->route()->parameter('user'); diff --git a/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php b/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php index 5f63d04b..d432ae3d 100644 --- a/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/GetExternalUserRequest.php @@ -10,24 +10,10 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetExternalUserRequest extends ApplicationApiRequest { - /** - * @var User - */ - private $userModel; + private User $userModel; + protected string $resource = AdminAcl::RESOURCE_USERS; + protected int $permission = AdminAcl::READ; - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_USERS; - - /** - * @var int - */ - protected $permission = AdminAcl::READ; - - /** - * Determine if the requested external user exists. - */ public function resourceExists(): bool { $repository = $this->container->make(UserRepositoryInterface::class); @@ -43,9 +29,6 @@ class GetExternalUserRequest extends ApplicationApiRequest return true; } - /** - * Return the user model for the requested external user. - */ public function getUserModel(): User { return $this->userModel; diff --git a/app/Http/Requests/Api/Application/Users/GetUserRequest.php b/app/Http/Requests/Api/Application/Users/GetUserRequest.php index e5b99daf..417cfd59 100644 --- a/app/Http/Requests/Api/Application/Users/GetUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/GetUserRequest.php @@ -6,11 +6,6 @@ use Pterodactyl\Models\User; class GetUserRequest extends GetUsersRequest { - /** - * Determine if the requested role exists on the Panel. - * - * @return bool - */ public function resourceExists(): bool { $user = $this->route()->parameter('user'); diff --git a/app/Http/Requests/Api/Application/Users/GetUsersRequest.php b/app/Http/Requests/Api/Application/Users/GetUsersRequest.php index 8736a8e9..406883f7 100644 --- a/app/Http/Requests/Api/Application/Users/GetUsersRequest.php +++ b/app/Http/Requests/Api/Application/Users/GetUsersRequest.php @@ -7,13 +7,6 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class GetUsersRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = Acl::RESOURCE_USERS; - - /** - * @var int - */ - protected $permission = Acl::READ; + protected string $resource = Acl::RESOURCE_USERS; + protected int $permission = Acl::READ; } diff --git a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php index 10a2d6b2..863cbea7 100644 --- a/app/Http/Requests/Api/Application/Users/StoreUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/StoreUserRequest.php @@ -8,19 +8,9 @@ use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest; class StoreUserRequest extends ApplicationApiRequest { - /** - * @var string - */ - protected $resource = AdminAcl::RESOURCE_USERS; + protected string $resource = AdminAcl::RESOURCE_USERS; + protected int $permission = AdminAcl::WRITE; - /** - * @var int - */ - protected $permission = AdminAcl::WRITE; - - /** - * Return the validation rules for this request. - */ public function rules(array $rules = null): array { $rules = $rules ?? User::getRules(); @@ -40,10 +30,7 @@ class StoreUserRequest extends ApplicationApiRequest return $response; } - /** - * @return array - */ - public function validated() + public function validated(): array { $data = parent::validated(); @@ -55,12 +42,7 @@ class StoreUserRequest extends ApplicationApiRequest return $data; } - /** - * Rename some fields to be more user friendly. - * - * @return array - */ - public function attributes() + public function attributes(): array { return [ 'external_id' => 'Third Party Identifier', diff --git a/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php b/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php index b341eaa2..ba6d9da2 100644 --- a/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php +++ b/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php @@ -6,13 +6,8 @@ use Pterodactyl\Models\User; class UpdateUserRequest extends StoreUserRequest { - /** - * Return the validation rules for this request. - */ public function rules(array $rules = null): array { - $userId = $this->getModel(User::class)->id; - - return parent::rules(User::getRulesForUpdate($userId)); + return parent::rules($rules ?? User::getRulesForUpdate($this->route()->parameter('user')->id)); } } diff --git a/app/Transformers/Api/Application/BaseTransformer.php b/app/Transformers/Api/Application/BaseTransformer.php index e6747b10..5bb664d2 100644 --- a/app/Transformers/Api/Application/BaseTransformer.php +++ b/app/Transformers/Api/Application/BaseTransformer.php @@ -17,20 +17,12 @@ abstract class BaseTransformer extends TransformerAbstract { public const RESPONSE_TIMEZONE = 'UTC'; - /** - * @var \Pterodactyl\Models\ApiKey - */ private ApiKey $key; - /** - * @var bool - */ private bool $rootAdmin; /** * Return the resource name for the JSONAPI output. - * - * @return string */ abstract public function getResourceName(): string; @@ -48,8 +40,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Set the HTTP request class being used for this request. * - * @param \Pterodactyl\Models\ApiKey $key - * * @return $this */ public function setKey(ApiKey $key) @@ -61,8 +51,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Return the request instance being used for this transformer. - * - * @return \Pterodactyl\Models\ApiKey */ public function getKey(): ApiKey { @@ -72,8 +60,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * ? * - * @param bool $rootAdmin - * * @return $this */ public function setRootAdmin(bool $rootAdmin) @@ -85,8 +71,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * ? - * - * @return bool */ public function isRootAdmin(): bool { @@ -97,10 +81,6 @@ abstract class BaseTransformer extends TransformerAbstract * Determine if the API key loaded onto the transformer has permission * to access a different resource. This is used when including other * models on a transformation request. - * - * @param string $resource - * - * @return bool */ protected function authorize(string $resource): bool { @@ -115,9 +95,6 @@ abstract class BaseTransformer extends TransformerAbstract * Create a new instance of the transformer and pass along the currently * set API key. * - * @param string $abstract - * @param array $parameters - * * @return \Pterodactyl\Transformers\Api\Application\BaseTransformer * * @throws \Illuminate\Contracts\Container\BindingResolutionException @@ -129,7 +106,7 @@ abstract class BaseTransformer extends TransformerAbstract $transformer = Container::getInstance()->makeWith($abstract, $parameters); $transformer->setKey($this->getKey()); - if (! $transformer instanceof self) { + if (!$transformer instanceof self) { throw new InvalidTransformerLevelException('Calls to ' . __METHOD__ . ' must return a transformer that is an instance of ' . __CLASS__); } @@ -138,10 +115,6 @@ abstract class BaseTransformer extends TransformerAbstract /** * Return an ISO-8601 formatted timestamp to use in the API response. - * - * @param string $timestamp - * - * @return string */ protected function formatTimestamp(string $timestamp): string { diff --git a/app/Transformers/Api/Application/LocationTransformer.php b/app/Transformers/Api/Application/LocationTransformer.php index c0ef249d..271942b4 100644 --- a/app/Transformers/Api/Application/LocationTransformer.php +++ b/app/Transformers/Api/Application/LocationTransformer.php @@ -41,6 +41,7 @@ class LocationTransformer extends BaseTransformer * * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * + * @throws \Illuminate\Contracts\Container\BindingResolutionException * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Location $location) @@ -59,7 +60,9 @@ class LocationTransformer extends BaseTransformer * * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource * + * @throws \Illuminate\Contracts\Container\BindingResolutionException * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException + */ public function includeNodes(Location $location) { diff --git a/tests/Integration/Api/Application/Location/LocationControllerTest.php b/tests/Integration/Api/Application/Location/LocationControllerTest.php index 150e01be..44aee54a 100644 --- a/tests/Integration/Api/Application/Location/LocationControllerTest.php +++ b/tests/Integration/Api/Application/Location/LocationControllerTest.php @@ -27,7 +27,7 @@ class LocationControllerTest extends ApplicationApiIntegrationTestCase ['object', 'attributes' => ['id', 'short', 'long', 'created_at', 'updated_at']], ['object', 'attributes' => ['id', 'short', 'long', 'created_at', 'updated_at']], ], - 'meta' => ['pagination' => ['total', 'count', 'per_page', 'current_page', 'total_pages']], + 'meta' => ['pagination' => ['total', 'count', 'per_page', 'current_page', 'total_pages', 'links']], ]); $response @@ -38,9 +38,10 @@ class LocationControllerTest extends ApplicationApiIntegrationTestCase 'pagination' => [ 'total' => 2, 'count' => 2, - 'per_page' => 100, + 'per_page' => 10, 'current_page' => 1, 'total_pages' => 1, + 'links' => [], ], ], ])