parfum/app/Helpers/StringHelpers.php

19 lines
473 B
PHP

<?php
use Illuminate\Support\Number;
use Illuminate\Support\Str;
if (! function_exists('formatCurrency')) {
function formatCurrency(string $value, ?string $format = 'IDR', ?string $locale = 'id_ID', int $precision = 0): string
{
return Number::currency($value, $format, $locale, $precision);
}
}
if (! function_exists('replaceCurrency')) {
function replaceCurrency(string $value)
{
return (int) Str::replace('.', '', $value);
}
}