misc_pterodactyl-panel/app/Http/Requests/Api/Application/Users/UpdateUserRequest.php
2018-01-19 19:58:57 -06:00

41 lines
905 B
PHP

<?php
namespace Pterodactyl\Http\Requests\Api\Application\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();
}
}