Fix helper implementation
Use class with static files instead of load it directly in composer json
This commit is contained in:
+12
-16
@@ -1,28 +1,25 @@
|
||||
<?php
|
||||
namespace App;
|
||||
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use DateTime;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
if (!function_exists('formatNumber')) {
|
||||
function formatNumber ($amount) {
|
||||
class Helper
|
||||
{
|
||||
|
||||
public static function formatNumber($amount)
|
||||
{
|
||||
$formattedAmount = number_format($amount, 2, '.', ',');
|
||||
|
||||
return $formattedAmount;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static function formatDate($date_string)
|
||||
{
|
||||
return (new DateTime($date_string))->format("d-m-Y");
|
||||
}
|
||||
|
||||
if (!function_exists('formatDate')) {
|
||||
function formatDate ($date_string) {
|
||||
return (new DateTime($date_string))->format("d-m-Y");
|
||||
};
|
||||
}
|
||||
|
||||
if (!function_exists('getActiveCawanganDbConnection')) {
|
||||
|
||||
function getActiveCawanganDbConnection()
|
||||
public static function getActiveCawanganDbConnection()
|
||||
{
|
||||
|
||||
$all_active_db_keys = array_filter(array_keys(config('database.connections')), function ($connection) {
|
||||
@@ -49,5 +46,4 @@ if (!function_exists('getActiveCawanganDbConnection')) {
|
||||
return $all_cawangan_db;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user