2018-01-20 22:03:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests\Api\Application\Servers;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\Server;
|
|
|
|
|
|
|
|
class UpdateServerDetailsRequest extends ServerWriteRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Rules to apply to a server details update request.
|
|
|
|
*/
|
|
|
|
public function rules(): array
|
|
|
|
{
|
2021-01-24 22:30:58 +00:00
|
|
|
$rules = Server::getRulesForUpdate($this->route()->parameter('server')->id);
|
2018-01-20 22:03:23 +00:00
|
|
|
|
|
|
|
return [
|
2018-02-25 20:45:16 +00:00
|
|
|
'external_id' => $rules['external_id'],
|
2018-01-20 22:03:23 +00:00
|
|
|
'name' => $rules['name'],
|
|
|
|
'user' => $rules['owner_id'],
|
2018-01-21 20:45:20 +00:00
|
|
|
'description' => array_merge(['nullable'], $rules['description']),
|
2018-01-20 22:03:23 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert the posted data into the correct format that is expected
|
|
|
|
* by the application.
|
|
|
|
*/
|
|
|
|
public function validated(): array
|
|
|
|
{
|
|
|
|
return [
|
2018-02-25 20:45:16 +00:00
|
|
|
'external_id' => $this->input('external_id'),
|
2018-01-20 22:03:23 +00:00
|
|
|
'name' => $this->input('name'),
|
|
|
|
'owner_id' => $this->input('user'),
|
|
|
|
'description' => $this->input('description'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Rename some of the attributes in error messages to clarify the field
|
|
|
|
* being discussed.
|
|
|
|
*/
|
|
|
|
public function attributes(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'user' => 'User ID',
|
|
|
|
'name' => 'Server Name',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|