Skip to content

A free open source IT asset/license management system

Add validation

Marcus Moore6588d409b85a
diff --git a/app/Http/Requests/StoreLabelSettings.php b/app/Http/Requests/StoreLabelSettings.php
index f9ede7ea89..2b6fd83c6f 100644
--- a/app/Http/Requests/StoreLabelSettings.php
+++ b/app/Http/Requests/StoreLabelSettings.php
@@ -37,8 +37,8 @@ class StoreLabelSettings extends FormRequest
return [
'labels_per_page' => 'numeric',
- 'labels_width' => 'numeric',
- 'labels_height' => 'numeric',
+ 'labels_width' => 'numeric|min:0.1',
+ 'labels_height' => 'numeric|min:0.1',
'labels_pmargin_left' => 'numeric|nullable',
'labels_pmargin_right' => 'numeric|nullable',
'labels_pmargin_top' => 'numeric|nullable',
diff --git a/resources/views/settings/labels.blade.php b/resources/views/settings/labels.blade.php
index b922eb95e2..8af236d625 100644
--- a/resources/views/settings/labels.blade.php
+++ b/resources/views/settings/labels.blade.php
@@ -426,15 +426,13 @@
<input class="form-control" aria-label="labels_width" name="labels_width" type="text" value="{{ old('labels_width', $setting->labels_width) }}" id="labels_width">
<div class="input-group-addon">{{ trans('admin/settings/general.width_w') }}</div>
</div>
+ {!! $errors->first('labels_width', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
<div class="col-md-3">
<div class="input-group">
<input class="form-control" aria-label="labels_height" name="labels_height" type="text" value="{{ old('labels_height', $setting->labels_height) }}">
<div class="input-group-addon">{{ trans('admin/settings/general.height_h') }}</div>
</div>
- </div>
- <div class="col-md-9 col-md-offset-3">
- {!! $errors->first('labels_width', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
{!! $errors->first('labels_height', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>
@@ -486,10 +484,6 @@
</div>
</div>
- <div class="col-md-9 col-md-offset-3">
- {!! $errors->first('labels_width', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
- {!! $errors->first('labels_height', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
- </div>
</div>
<div class="form-group{{ (($errors->has('labels_pageheight')) || $errors->has('labels_pagewidth')) ? ' has-error' : '' }}">