2020-12-13 19:07:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Settings;
|
|
|
|
|
|
|
|
use Webmozart\Assert\Assert;
|
|
|
|
use Pterodactyl\Models\Server;
|
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
use Pterodactyl\Models\Permission;
|
|
|
|
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
|
|
|
|
2021-08-05 03:55:15 +00:00
|
|
|
class SetDockerImageRequest extends ClientApiRequest
|
2020-12-13 19:07:29 +00:00
|
|
|
{
|
|
|
|
public function permission(): string
|
|
|
|
{
|
|
|
|
return Permission::ACTION_STARTUP_DOCKER_IMAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array[]
|
|
|
|
*/
|
|
|
|
public function rules(): array
|
|
|
|
{
|
|
|
|
/** @var \Pterodactyl\Models\Server $server */
|
|
|
|
$server = $this->route()->parameter('server');
|
|
|
|
|
|
|
|
Assert::isInstanceOf($server, Server::class);
|
|
|
|
|
|
|
|
return [
|
|
|
|
'docker_image' => ['required', 'string', Rule::in($server->egg->docker_images)],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|