Thousand separator in forms

[亡魂溺海] 提交于 2019-12-10 16:16:45

问题


I'm trying to add thousand separators to my inputs, how can I do it? I tried to use Laravel\Nova\Fields\Currency in my fields() method, but it doesn't help. It still shows value in the input like:

100000

And I want to show it like:

100,000

How can I achieve it in Laravel Nova?

public function fields(Request $request)
{
    $fields = [];

    ...
    $fields[] = Currency::make(__('Price'), 'price');

    return $fields;
}

回答1:


use number_format() doc or money_format() doc (won't work on windows), which were available in php.




回答2:


You can use this package, I just about to write it recently: https://novapackages.com/packages/lathanhvien/nova-text-currency



来源:https://stackoverflow.com/questions/57551781/thousand-separator-in-forms

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!