3
I would like to know how to format monetary values in Laravel. Is there a Package or method that is for the framework?
{{ $lst->vl_valor_tot_contrato }}
is displayed with monetary formatting like this: (R$ 105.273,54)
3
I would like to know how to format monetary values in Laravel. Is there a Package or method that is for the framework?
{{ $lst->vl_valor_tot_contrato }}
is displayed with monetary formatting like this: (R$ 105.273,54)
6
To do this on the server side with PHP use the function money_format
.
For example:
{{ money_format('%n', $lst->vl_valor_tot_contrato ) }}
Also remember to set the locale correctly in PHP.
setlocale(LC_MONETARY, 'pt_BR');
If the function money_format
not available in your installation, you can also get the result with the function number_format
{{ 'R$ '.number_format($lst->vl_valor_tot_contrato, 2, ',', '.') }}
Sources:
Browser other questions tagged laravel-5 formatting monetary-value
You are not signed in. Login or sign up in order to post.
Could you post the snippet of code where you need help? It would help the community understand your problem.
– Felipe Paetzold
Simples @Felipepaetzold ... {{ $lst->vl_valor_tot_contrato }} is displayed in monetary format Ex. R$ 105.273,54
– Isaac Batista
In your case I think it would be better if you create a js mask or use the jquery Money library (https://plugins.jquery.com/maskMoney/) .
– Felipe Paetzold