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>
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api\Application\Servers;
|
|
|
|
use App\Models\Server;
|
|
use App\Services\Acl\Api\AdminAcl;
|
|
use App\Http\Requests\Api\Application\ApplicationApiRequest;
|
|
|
|
class UpdateServerStartupRequest extends ApplicationApiRequest
|
|
{
|
|
protected ?string $resource = Server::RESOURCE_NAME;
|
|
|
|
protected int $permission = AdminAcl::WRITE;
|
|
|
|
/**
|
|
* Validation rules to run the input against.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
$data = Server::getRulesForUpdate($this->parameter('server', Server::class));
|
|
|
|
return [
|
|
'startup' => 'sometimes|string',
|
|
'environment' => 'present|array',
|
|
'egg' => $data['egg_id'],
|
|
'image' => 'sometimes|string',
|
|
'skip_scripts' => 'present|boolean',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Return the validated data in a format that is expected by the service.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function validated($key = null, $default = null): array
|
|
{
|
|
$data = parent::validated();
|
|
|
|
return collect($data)->only(['startup', 'environment', 'skip_scripts'])->merge([
|
|
'egg_id' => array_get($data, 'egg'),
|
|
'docker_image' => array_get($data, 'image'),
|
|
])->toArray();
|
|
}
|
|
}
|