Additional checks for exchange rates

This commit is contained in:
David Bomba 2022-10-27 11:59:14 +11:00
parent a9004fa9f7
commit 6ef7d5ec6a

View File

@ -13,6 +13,7 @@ namespace App\Utils;
use App\Libraries\MultiDB;
use App\Mail\TestMailServer;
use App\Models\Company;
use Exception;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
@ -82,9 +83,34 @@ class SystemHealth
'queue' => (string) config('queue.default'),
'trailing_slash' => (bool) self::checkUrlState(),
'file_permissions' => (string) self::checkFileSystem(),
'exchange_rate_api_not_configured' => (bool)self::checkCurrencySanity(),
];
}
private static function checkCurrencySanity()
{
if(strlen(config('ninja.currency_converter_api_key')) == 0){
$cs = DB::table('clients')
->select('settings->currency_id as id')
->get();
$currency_count = $cs->unique('id')->filter(function ($value){
return !is_null($value->id);
})->count();
if($currency_count > 1)
return true;
}
return false;
}
private static function checkQueueSize()
{
$count = 0;