mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-23 00:33:46 +02:00
api(application): fix requests
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user