Explorar o código

Form::currency 保存时过滤逗号

jqh %!s(int64=4) %!d(string=hai) anos
pai
achega
fcae856e66
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  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}
      */