misc_pterodactyl-panel/app/Http/Requests/API/Admin/Users/UpdateUserRequest.php

42 lines
899 B
PHP
Raw Normal View History

<?php
namespace Pterodactyl\Http\Requests\API\Admin\Users;
use Pterodactyl\Models\User;
class UpdateUserRequest extends StoreUserRequest
{
/**
* Determine if the requested user exists on the Panel.
*
* @return bool
*/
public function resourceExists(): bool
{
$user = $this->route()->parameter('user');
return $user instanceof User && $user->exists;
}
/**
* Return the validation rules for this request.
*
* @return array
*/
public function rules(): array
{
$userId = $this->route()->parameter('user')->id;
return collect(User::getUpdateRulesForId($userId))->only([
'external_id',
'email',
'username',
'name_first',
'name_last',
'password',
'language',
'root_admin',
])->toArray();
}
}