api(application): v2 backport
This commit is contained in:
parent
4cd0bee231
commit
67bf3e342e
172 changed files with 2922 additions and 1579 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Pterodactyl\Http\Requests\Api\Application\Servers;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Pterodactyl\Models\Server;
|
||||
|
||||
class UpdateServerDetailsRequest extends ServerWriteRequest
|
||||
|
@ -11,7 +12,7 @@ class UpdateServerDetailsRequest extends ServerWriteRequest
|
|||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = Server::getRulesForUpdate($this->parameter('server', Server::class));
|
||||
$rules = Server::getRulesForUpdate($this->route()->parameter('server')->id);
|
||||
|
||||
return [
|
||||
'external_id' => $rules['external_id'],
|
||||
|
@ -24,19 +25,24 @@ class UpdateServerDetailsRequest extends ServerWriteRequest
|
|||
/**
|
||||
* Convert the posted data into the correct format that is expected
|
||||
* by the application.
|
||||
*
|
||||
* @param string|null $key
|
||||
* @param string|array|null $default
|
||||
*/
|
||||
public function validated($key = null, $default = null): array
|
||||
public function validated($key = null, $default = null)
|
||||
{
|
||||
return [
|
||||
$data = [
|
||||
'external_id' => $this->input('external_id'),
|
||||
'name' => $this->input('name'),
|
||||
'owner_id' => $this->input('user'),
|
||||
'description' => $this->input('description'),
|
||||
];
|
||||
|
||||
return is_null($key) ? $data : Arr::get($data, $key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename some attributes in error messages to clarify the field
|
||||
* Rename some of the attributes in error messages to clarify the field
|
||||
* being discussed.
|
||||
*/
|
||||
public function attributes(): array
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue