allow setting variable options to "0", closes #87

This commit is contained in:
Dane Everitt 2016-09-17 20:25:13 -04:00
parent 812b869be8
commit d9f1a7faf7
2 changed files with 8 additions and 4 deletions

View file

@ -181,7 +181,11 @@ class ServiceController extends Controller
// Because of the way old() works on the display side we prefix all of the variables with thier ID
// We need to remove that prefix here since the repo doesn't want it.
$data = [];
$data = [
'user_viewable' => '0',
'user_editable' => '0',
'required' => '0'
];
foreach($request->except(['_token']) as $id => $val) {
$data[str_replace($variable.'_', '', $id)] = $val;
}

View file

@ -101,9 +101,9 @@ class Variable
'description' => 'sometimes|required|string',
'env_variable' => 'sometimes|required|regex:/^[\w]{1,255}$/',
'default_value' => 'sometimes|string|max:255',
'user_viewable' => 'sometimes|required|numeric|size:1',
'user_editable' => 'sometimes|required|numeric|size:1',
'required' => 'sometimes|required|numeric|size:1',
'user_viewable' => 'sometimes|required|numeric|boolean',
'user_editable' => 'sometimes|required|numeric|boolean',
'required' => 'sometimes|required|numeric|boolean',
'regex' => 'sometimes|required|string|min:1'
]);