Skip to content

A free open source IT asset/license management system

Fixes #4094 - more nullables

snipe07359c76adbd
diff --git a/app/Http/Controllers/SuppliersController.php b/app/Http/Controllers/SuppliersController.php
index dab7ba874b..a6e8552df9 100755
--- a/app/Http/Controllers/SuppliersController.php
+++ b/app/Http/Controllers/SuppliersController.php
@@ -87,9 +87,8 @@ class SuppliersController extends Controller
$supplier->image = $file_name;
}
- // Was it created?
if ($supplier->save()) {
- // Redirect to the new supplier page
+ // Redirect to the nw supplier page
return redirect()->route('suppliers.index')->with('success', trans('admin/suppliers/message.create.success'));
}
return redirect()->back()->withInput()->withErrors($supplier->getErrors());
diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php
index 4e48acd359..eb61e8f28e 100755
--- a/app/Models/Supplier.php
+++ b/app/Models/Supplier.php
@@ -15,18 +15,18 @@ class Supplier extends SnipeModel
protected $rules = array(
'name' => 'required|min:3|max:255|unique_undeleted',
- 'address' => 'min:3|max:50',
- 'address2' => 'min:2|max:50',
- 'city' => 'min:3|max:255',
- 'state' => 'min:0|max:32',
- 'country' => 'min:0|max:2',
- 'fax' => 'min:7|max:35',
- 'phone' => 'min:7|max:35',
- 'contact' => 'min:0|max:100',
- 'notes' => 'min:0|max:255',
- 'email' => 'email|min:5|max:150',
- 'zip' => 'min:0|max:10',
- 'url' => 'min:3|max:250',
+ 'address' => 'max:50|nullable',
+ 'address2' => 'max:50|nullable',
+ 'city' => 'max:255|nullable',
+ 'state' => 'max:32|nullable',
+ 'country' => 'max:3|nullable',
+ 'fax' => 'min:7|max:35|nullable',
+ 'phone' => 'min:7|max:35|nullable',
+ 'contact' => 'max:100|nullable',
+ 'notes' => 'max:255|nullable',
+ 'email' => 'email|max:150|nullable',
+ 'zip' => 'max:10|nullable',
+ 'url' => 'url|nullable',
);
/**