- 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.
13 lines
387 B
PHP
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, ',', '.');
|
|
}
|
|
}
|