diff --git a/app/Http/Controllers/Api/Application/ApplicationApiController.php b/app/Http/Controllers/Api/Application/ApplicationApiController.php index 941be0620..5f9b23d8f 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 db469bc5e..1a9ff2e5e 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 9fab4e2c3..1729d7209 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 524e201e1..b811fe526 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 d1f5415a6..5bd79970d 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 6bb3bed38..143549dbf 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 7bd16d0e6..6227fec30 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 3281f8767..0efd8e5d0 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 3e2912340..166064f9f 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 7de511b3f..feb2c8ad0 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 ce98c1cc5..600a93efa 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 7561713c1..476719005 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 2a774d5c2..a3ce1f2c3 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 9405cb809..a01d6db37 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 8323a369d..fb2015a3f 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 4e43bae70..7b3cad7e5 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 ea35d0067..0ce5db572 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 ac58314f9..ba97ec198 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 f7c10e0c0..59c3605dd 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 5edf00462..1a79846ef 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 c5586ead1..08f9a1da6 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 c775e2b1b..6229870ba 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 232f3ea94..0bef09b67 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 d0bad1751..e6fa96b26 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 eaee2206b..c56268625 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 297ec46c8..504247a2e 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 e14d816c7..5922677e6 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 b75b76840..e6e4f423f 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 7a3aa3c51..b9b51b12c 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 16843389b..92fbde617 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 db6be4f84..370d7eab0 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 b90c45748..ec04e8edb 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 5168dcfcd..5be1f4be9 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 7f425ddf5..1c7aaec89 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 eb1d1d9a5..f9806ecbf 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 0eae14008..fd077ecd5 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 bbb157035..d8098a0d9 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 fc5f5a38e..4df2c8523 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 8c05c5a37..e196ba100 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 2da2d4061..05daebc2e 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 94c73d0a8..02d042aca 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 cd583c85c..287323ed6 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 567765da9..3384b3efd 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 bb57fc511..7e1b6521c 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 11ec03eb7..de3221abd 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 56c028a6e..185277614 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 5f63d04ba..d432ae3d9 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 e5b99daf3..417cfd59a 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 8736a8e9d..406883f7e 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 10a2d6b28..863cbea74 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 b341eaa24..ba6d9da2c 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 e6747b107..5bb664d2b 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 c0ef249d7..271942b49 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 150e01bea..44aee54a9 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' => [], ], ], ])