浏览代码

Form::currency 保存时过滤逗号

jqh 4 年之前
父节点
当前提交
fcae856e66
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      src/Form/Field/Currency.php

+ 10 - 0
src/Form/Field/Currency.php

@@ -51,6 +51,16 @@ class Currency extends Text
         return $this->options(compact('digits'));
     }
 
+    /**
+     * @param mixed $value
+     *
+     * @return mixed
+     */
+    protected function prepareInputValue($value)
+    {
+        return str_replace(',', '', $value);
+    }
+
     /**
      * {@inheritdoc}
      */