Updated validation to allow nullable integrers #3064

This commit is contained in:
snipe 2016-12-15 04:11:31 -08:00
parent e67b3e474f
commit 2f03c5ddb0
4 changed files with 13 additions and 13 deletions

View file

@ -31,7 +31,7 @@ class AssetMaintenance extends Model implements ICompanyableChild
'start_date' => 'required|date_format:Y-m-d',
'completion_date' => 'date_format:Y-m-d',
'notes' => 'string',
'cost' => 'numeric'
'cost' => 'numeric|nullable'
];
public function getCompanyableParents()

View file

@ -35,9 +35,9 @@ class Component extends SnipeModel
'name' => 'required|min:3|max:255',
'qty' => 'required|integer|min:1',
'category_id' => 'required|integer',
'company_id' => 'integer',
'purchase_date' => 'date',
'purchase_cost' => 'numeric',
'company_id' => 'integer|nullable',
'purchase_date' => 'date|nullable',
'purchase_cost' => 'numeric|nullable',
);
/**

View file

@ -30,9 +30,9 @@ class Consumable extends SnipeModel
'name' => 'required|min:3|max:255',
'qty' => 'required|integer|min:0',
'category_id' => 'required|integer',
'company_id' => 'integer',
'company_id' => 'integer|nullable',
'min_amt' => 'integer|min:1',
'purchase_cost' => 'numeric',
'purchase_cost' => 'numeric|nullable',
);
/**

View file

@ -15,13 +15,13 @@ class Location extends SnipeModel
protected $dates = ['deleted_at'];
protected $table = 'locations';
protected $rules = array(
'name' => 'required|min:3|max:255|unique_undeleted',
'city' => 'min:3|max:255',
'state' => 'min:0|max:2',
'country' => 'min:2|max:2',
'address' => 'min:5|max:80',
'address2' => 'min:2|max:80',
'zip' => 'min:3|max:10',
'name' => 'required|min:2|max:255|unique_undeleted',
'city' => 'min:3|max:255|nullable',
'state' => 'max:2|nullable',
'country' => 'min:2|max:2|nullable',
'address' => 'max:80|nullable',
'address2' => 'max:80|nullable',
'zip' => 'min:3|max:10|nullable',
);
/**