Fix bad API behavior
This commit is contained in:
parent
d4d9eda57a
commit
2ec76d283b
10 changed files with 86 additions and 68 deletions
|
@ -6,19 +6,6 @@ use Pterodactyl\Models\Node;
|
|||
|
||||
class UpdateNodeRequest extends StoreNodeRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the node being requested for editing exists
|
||||
* on the Panel before validating the data.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function resourceExists(): bool
|
||||
{
|
||||
$node = $this->route()->parameter('node');
|
||||
|
||||
return $node instanceof Node && $node->exists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply validation rules to this request. Uses the parent class rules()
|
||||
* function but passes in the rules for updating rather than creating.
|
||||
|
@ -28,7 +15,7 @@ class UpdateNodeRequest extends StoreNodeRequest
|
|||
*/
|
||||
public function rules(array $rules = null): array
|
||||
{
|
||||
$nodeId = $this->route()->parameter('node')->id;
|
||||
$nodeId = $this->getModel(Node::class)->id;
|
||||
|
||||
return parent::rules(Node::getUpdateRulesForId($nodeId));
|
||||
}
|
||||
|
|
Reference in a new issue