mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-15 12:53:44 +02:00
Fix bad API behavior
This commit is contained in:
@@ -6,36 +6,16 @@ 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.
|
||||
*
|
||||
* @param array|null $rules
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
public function rules(array $rules = null): array
|
||||
{
|
||||
$userId = $this->route()->parameter('user')->id;
|
||||
$userId = $this->getModel(User::class)->id;
|
||||
|
||||
return collect(User::getUpdateRulesForId($userId))->only([
|
||||
'external_id',
|
||||
'email',
|
||||
'username',
|
||||
'name_first',
|
||||
'name_last',
|
||||
'password',
|
||||
'language',
|
||||
'root_admin',
|
||||
])->toArray();
|
||||
return parent::rules(User::getUpdateRulesForId($userId));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user