Fix behavior of validation when creating egg variables
This commit is contained in:
parent
303b64ced1
commit
d52f8d9215
2 changed files with 1 additions and 20 deletions
|
@ -19,6 +19,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* PHP 7.2 is now the minimum required version for this software.
|
* PHP 7.2 is now the minimum required version for this software.
|
||||||
|
* Egg variable default values are no longer validated aganist the ruleset when configuring them. Validation of those rules will only occur when editing or creating a server.
|
||||||
|
|
||||||
## v0.7.0-rc.2 (Derelict Dermodactylus)
|
## v0.7.0-rc.2 (Derelict Dermodactylus)
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -23,24 +23,4 @@ class EggVariableFormRequest extends AdminFormRequest
|
||||||
'default_value' => 'present',
|
'default_value' => 'present',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Run validation after the rules above have been applied.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Validation\Validator $validator
|
|
||||||
*/
|
|
||||||
public function withValidator($validator)
|
|
||||||
{
|
|
||||||
$rules = $this->input('rules');
|
|
||||||
if ($this->method() === 'PATCH') {
|
|
||||||
$rules = $this->input('rules', $this->route()->parameter('egg')->rules);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If rules is not a string it is already violating the rule defined above
|
|
||||||
// so just skip the addition of default value rules since this request
|
|
||||||
// will fail anyways.
|
|
||||||
$validator->sometimes('default_value', $rules, function () use ($rules) {
|
|
||||||
return is_string($rules);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue