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

* Not found property rule * Make these “better” * Day 1 * Day 2 * Day 3 * Dat 4 * Remove disabled check * Day 4 continued * Run pint * Final changes hopefully * Pint fixes * Fix again * Reset these * Update app/Filament/Admin/Pages/Health.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> * Update app/Traits/CheckMigrationsTrait.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> --------- Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com>
73 lines
1.9 KiB
PHP
73 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api\Application\Nodes;
|
|
|
|
use App\Models\Node;
|
|
use App\Services\Acl\Api\AdminAcl;
|
|
use App\Http\Requests\Api\Application\ApplicationApiRequest;
|
|
|
|
class StoreNodeRequest extends ApplicationApiRequest
|
|
{
|
|
protected ?string $resource = Node::RESOURCE_NAME;
|
|
|
|
protected int $permission = AdminAcl::WRITE;
|
|
|
|
/**
|
|
* @param array<string, string|string[]>|null $rules
|
|
* @return array<string, string|string[]>
|
|
*/
|
|
public function rules(?array $rules = null): array
|
|
{
|
|
return collect($rules ?? Node::getRules())->only([
|
|
'public',
|
|
'name',
|
|
'description',
|
|
'fqdn',
|
|
'scheme',
|
|
'behind_proxy',
|
|
'maintenance_mode',
|
|
'memory',
|
|
'memory_overallocate',
|
|
'disk',
|
|
'disk_overallocate',
|
|
'cpu',
|
|
'cpu_overallocate',
|
|
'upload_size',
|
|
'daemon_listen',
|
|
'daemon_sftp',
|
|
'daemon_sftp_alias',
|
|
'daemon_base',
|
|
])->mapWithKeys(function ($value, $key) {
|
|
return [snake_case($key) => $value];
|
|
})->toArray();
|
|
}
|
|
|
|
/**
|
|
* Fields to rename for clarity in the API response.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'daemon_base' => 'Daemon Base Path',
|
|
'upload_size' => 'File Upload Size Limit',
|
|
'public' => 'Node Visibility',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Change the formatting of some data keys in the validated response data
|
|
* to match what the application expects in the services.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function validated($key = null, $default = null): array
|
|
{
|
|
$response = parent::validated();
|
|
$response['daemon_base'] = $response['daemon_base'] ?? (new Node())->getAttribute('daemon_base');
|
|
|
|
return $response;
|
|
}
|
|
}
|