问题
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