mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-19 21:04:44 +02:00

* Add Nullable * Edit filament & AppServiceProvider * Pint * Patch tests * Actually patching tests * Actually patching tests * Remove length * Remove defaultStringLength * Let’s see the differences --------- Co-authored-by: Lance Pioch <git@lance.sh>
35 lines
890 B
PHP
35 lines
890 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api\Application\Allocations;
|
|
|
|
use App\Services\Acl\Api\AdminAcl;
|
|
use App\Http\Requests\Api\Application\ApplicationApiRequest;
|
|
|
|
class StoreAllocationRequest extends ApplicationApiRequest
|
|
{
|
|
protected ?string $resource = AdminAcl::RESOURCE_ALLOCATIONS;
|
|
|
|
protected int $permission = AdminAcl::WRITE;
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'ip' => 'required|string',
|
|
'alias' => 'sometimes|nullable|string|max:255',
|
|
'ports' => 'required|array',
|
|
'ports.*' => 'string',
|
|
];
|
|
}
|
|
|
|
public function validated($key = null, $default = null): array
|
|
{
|
|
$data = parent::validated();
|
|
|
|
return [
|
|
'allocation_ip' => $data['ip'],
|
|
'allocation_ports' => $data['ports'],
|
|
'allocation_alias' => $data['alias'] ?? null,
|
|
];
|
|
}
|
|
}
|