A free open source IT asset/license management system
Add conditional
Marcus Moore30bd92049724
diff --git a/app/Http/Requests/StoreAssetRequest.php b/app/Http/Requests/StoreAssetRequest.phpindex fb23ac8f2f..bbf3a98442 100644--- a/app/Http/Requests/StoreAssetRequest.php+++ b/app/Http/Requests/StoreAssetRequest.php@@ -47,12 +47,14 @@ class StoreAssetRequest extends ImageUploadRequest{$modelRules = (new Asset)->getRules();- // If purchase_cost was submitted as a string with a comma separator- // then we need to ignore the normal numeric rules.- // Since the original rules still live on the model they will be run- // right before saving (and after purchase_cost has been- // converted to a float via setPurchaseCostAttribute).- $modelRules = $this->removeNumericRulesFromPurchaseCost($modelRules);+ if (is_string($this->input('purchase_cost'))) {+ // If purchase_cost was submitted as a string with a comma separator+ // then we need to ignore the normal numeric rules.+ // Since the original rules still live on the model they will be run+ // right before saving (and after purchase_cost has been+ // converted to a float via setPurchaseCostAttribute).+ $modelRules = $this->removeNumericRulesFromPurchaseCost($modelRules);+ }return array_merge($modelRules,