From 2c1f3688286bd3b6692800ffe6411ff3c21107ba Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 10 May 2022 16:26:06 -0700 Subject: [PATCH] adds validation for all purchase costs variables --- app/Models/Accessory.php | 2 +- app/Models/Component.php | 2 +- app/Models/Consumable.php | 2 +- app/Models/License.php | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php index bc7c533832..50abf84b21 100755 --- a/app/Models/Accessory.php +++ b/app/Models/Accessory.php @@ -61,7 +61,7 @@ class Accessory extends SnipeModel 'category_id' => 'required|integer|exists:categories,id', 'company_id' => 'integer|nullable', 'min_amt' => 'integer|min:0|nullable', - 'purchase_cost' => 'numeric|nullable', + 'purchase_cost' => 'numeric|nullable|gte:0', ]; diff --git a/app/Models/Component.php b/app/Models/Component.php index a94371ec6f..fb841d3074 100644 --- a/app/Models/Component.php +++ b/app/Models/Component.php @@ -36,7 +36,7 @@ class Component extends SnipeModel 'company_id' => 'integer|nullable', 'min_amt' => 'integer|min:0|nullable', 'purchase_date' => 'date|nullable', - 'purchase_cost' => 'numeric|nullable', + 'purchase_cost' => 'numeric|nullable|gte:0', ]; /** diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php index 0c3dc247e7..bb0ebb60de 100644 --- a/app/Models/Consumable.php +++ b/app/Models/Consumable.php @@ -39,7 +39,7 @@ class Consumable extends SnipeModel 'category_id' => 'required|integer', 'company_id' => 'integer|nullable', 'min_amt' => 'integer|min:0|nullable', - 'purchase_cost' => 'numeric|nullable', + 'purchase_cost' => 'numeric|nullable|gte:0', ]; /** diff --git a/app/Models/License.php b/app/Models/License.php index 2c7efacf23..58b4854a33 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -48,6 +48,7 @@ class License extends Depreciable 'notes' => 'string|nullable', 'category_id' => 'required|exists:categories,id', 'company_id' => 'integer|nullable', + 'purchase_cost'=> 'numeric|nullable|gte:0', ]; /**