Fix behavior of validation when creating egg variables

This commit is contained in:
Dane Everitt 2018-02-17 13:09:54 -06:00
parent 303b64ced1
commit d52f8d9215
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 1 additions and 20 deletions

View file

@ -19,6 +19,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
### Changed
* 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)
### Fixed

View file

@ -23,24 +23,4 @@ class EggVariableFormRequest extends AdminFormRequest
'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);
});
}
}