Files

35 lines
914 B
PHP
Raw Permalink Normal View History

2018-01-27 12:38:56 -06:00
<?php
namespace Pterodactyl\Http\Requests\Api\Application\Allocations;
use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Http\Requests\Api\Application\ApplicationApiRequest;
class StoreAllocationRequest extends ApplicationApiRequest
{
2022-10-14 10:59:20 -06:00
protected ?string $resource = AdminAcl::RESOURCE_ALLOCATIONS;
2018-01-27 12:38:56 -06:00
2022-10-14 10:59:20 -06:00
protected int $permission = AdminAcl::WRITE;
2018-01-27 12:38:56 -06:00
public function rules(): array
{
return [
'ip' => 'required|string',
'alias' => 'sometimes|nullable|string|max:191',
2018-01-27 12:38:56 -06:00
'ports' => 'required|array',
'ports.*' => 'string',
];
}
2022-10-14 10:59:20 -06:00
public function validated($key = null, $default = null): array
2018-01-27 12:38:56 -06:00
{
$data = parent::validated();
return [
'allocation_ip' => $data['ip'],
'allocation_ports' => $data['ports'],
'allocation_alias' => $data['alias'] ?? null,
2018-01-27 12:38:56 -06:00
];
}
}