Files
basicdata/app/Helpers/Currency.php
Daeng Deni Mardaeni 9049075b0f feat(basicdata): tambahkan helper format_currency
- Menambahkan file helper `Currency.php` untuk format mata uang.
- Menyediakan fungsi `format_currency` yang mendukung parameter angka dan kode mata uang.
- Memperbarui `module.json` untuk memuat file helper secara otomatis.
2025-04-27 19:08:41 +07:00

13 lines
387 B
PHP

<?php
use Modules\Basicdata\Models\Currency;
if(!function_exists('format_currency')) {
function format_currency($number, $currency = 'IDR') {
$currency = Currency::where('code', $currency)->first();
$symbol = $currency->symbol?? '';
return $symbol . ' ' . number_format($number, $currency->decimal_places, ',', '.');
}
}