using the placeholder value if nothing is specified in rules on a new variable fixes #564

This commit is contained in:
kasper Franz 2017-08-26 10:16:09 +02:00
parent b2429f1b55
commit 3de57df3d0
2 changed files with 8 additions and 0 deletions

View file

@ -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',