prevents values for assets being negative through validation

This commit is contained in:
Godfrey M 2022-05-10 16:19:06 -07:00
parent 72fe0d22ea
commit 33b1ab3658
2 changed files with 5 additions and 1 deletions

View file

@ -111,7 +111,7 @@ class Asset extends Depreciable
'asset_tag' => 'required|min:1|max:255|unique_undeleted', 'asset_tag' => 'required|min:1|max:255|unique_undeleted',
'status' => 'integer', 'status' => 'integer',
'serial' => 'unique_serial|nullable', 'serial' => 'unique_serial|nullable',
'purchase_cost' => 'numeric|nullable', 'purchase_cost' => 'numeric|nullable|gte:0',
'next_audit_date' => 'date|nullable', 'next_audit_date' => 'date|nullable',
'last_audit_date' => 'date|nullable', 'last_audit_date' => 'date|nullable',
'supplier_id' => 'exists:suppliers,id|nullable', 'supplier_id' => 'exists:suppliers,id|nullable',

View file

@ -91,6 +91,10 @@ return [
'url' => 'The :attribute format is invalid.', 'url' => 'The :attribute format is invalid.',
'unique_undeleted' => 'The :attribute must be unique.', 'unique_undeleted' => 'The :attribute must be unique.',
'non_circular' => 'The :attribute must not create a circular reference.', 'non_circular' => 'The :attribute must not create a circular reference.',
'gte' => [
'numeric' => 'Value cannot be negative'
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------