Skip to content

A free open source IT asset/license management system

Make validation match database fields

snipef1d85c67f1a6
diff --git a/app/Models/Location.php b/app/Models/Location.php
index c3ddaa7598..2f4e78dcc7 100755
--- a/app/Models/Location.php
+++ b/app/Models/Location.php
@@ -26,11 +26,12 @@ class Location extends SnipeModel
protected $table = 'locations';
protected $rules = [
'name' => 'required|min:2|max:255|unique_undeleted',
- 'city' => 'min:2|max:255|nullable',
- 'country' => 'min:2|max:255|nullable',
- 'address' => 'max:80|nullable',
- 'address2' => 'max:80|nullable',
- 'zip' => 'min:3|max:12|nullable',
+ 'address' => 'max:191|nullable',
+ 'address2' => 'max:191|nullable',
+ 'city' => 'max:191|nullable',
+ 'state' => 'min:2|max:191|nullable',
+ 'country' => 'min:2|max:191|nullable',
+ 'zip' => 'max:10|nullable',
'manager_id' => 'exists:users,id|nullable',
'parent_id' => 'non_circular:locations,id',
];
diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php
index fa00fbad2a..e198d10c10 100755
--- a/app/Models/Supplier.php
+++ b/app/Models/Supplier.php
@@ -16,17 +16,17 @@ class Supplier extends SnipeModel
protected $table = 'suppliers';
protected $rules = [
- 'name' => 'required|min:1|max:255|unique_undeleted',
- 'address' => 'max:250|nullable',
- 'address2' => 'max:250|nullable',
- 'city' => 'max:255|nullable',
- 'state' => 'max:32|nullable',
- 'country' => 'max:3|nullable',
+ 'name' => 'required|min:1|max:255|unique_undeleted',
'fax' => 'min:7|max:35|nullable',
'phone' => 'min:7|max:35|nullable',
'contact' => 'max:100|nullable',
'notes' => 'max:191|nullable', // Default string length is 191 characters..
'email' => 'email|max:150|nullable',
+ 'address' => 'max:250|nullable',
+ 'address2' => 'max:250|nullable',
+ 'city' => 'max:191|nullable',
+ 'state' => 'min:2|max:191|nullable',
+ 'country' => 'min:2|max:191|nullable',
'zip' => 'max:10|nullable',
'url' => 'sometimes|nullable|string|max:250',
];
diff --git a/app/Models/User.php b/app/Models/User.php
index 36e1c8ac47..1e63ebad71 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -98,6 +98,11 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
'start_date' => 'nullable|date_format:Y-m-d',
'end_date' => 'nullable|date_format:Y-m-d|after_or_equal:start_date',
'autoassign_licenses' => 'boolean',
+ 'address' => 'max:191|nullable',
+ 'city' => 'max:191|nullable',
+ 'state' => 'min:2|max:191|nullable',
+ 'country' => 'min:2|max:191|nullable',
+ 'zip' => 'max:10|nullable',
];
/**