diff --git a/app/Models/Asset.php b/app/Models/Asset.php index ac373b2ad4..3466cbffe7 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -111,7 +111,7 @@ class Asset extends Depreciable 'asset_tag' => 'required|min:1|max:255|unique_undeleted', 'status' => 'integer', 'serial' => 'unique_serial|nullable', - 'purchase_cost' => 'numeric|nullable', + 'purchase_cost' => 'numeric|nullable|gte:0', 'next_audit_date' => 'date|nullable', 'last_audit_date' => 'date|nullable', 'supplier_id' => 'exists:suppliers,id|nullable', diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 72b465f211..5f097b717c 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -91,6 +91,10 @@ return [ 'url' => 'The :attribute format is invalid.', 'unique_undeleted' => 'The :attribute must be unique.', 'non_circular' => 'The :attribute must not create a circular reference.', + 'gte' => [ + 'numeric' => 'Value cannot be negative' + ], + /* |--------------------------------------------------------------------------