diff --git a/CHANGELOG.md b/CHANGELOG.md index b28f1325a..8399f84b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. * Support for CS:GO as a default service option selection. * Support for GMOD as a default service option selection. +### Fixed +* Using default value in rules when creating a new variable if the rules is empty. + ## v0.6.4 (Courageous Carniadactylus) ### Fixed * Fixed the console rendering on page load, I guess people don't like watching it load line-by-line for 10 minutes. Who would have guessed... diff --git a/app/Repositories/VariableRepository.php b/app/Repositories/VariableRepository.php index 1aded8293..9dc597e50 100644 --- a/app/Repositories/VariableRepository.php +++ b/app/Repositories/VariableRepository.php @@ -47,6 +47,11 @@ class VariableRepository { $option = ServiceOption::select('id')->findOrFail($option); + // If there is not a rules present let's populate it with the default/placeholder value. + if(!array_key_exists('rules',$data) || empty($data['rules'])){ + $data['rules'] = 'required|string|max:20'; + } + $validator = Validator::make($data, [ 'name' => 'required|string|min:1|max:255', 'description' => 'sometimes|nullable|string',