cache the info

This commit is contained in:
Denis Duliçi 2023-05-06 00:24:18 +03:00
parent e33c1ac66f
commit 371ec3084f

View File

@ -13,7 +13,13 @@ class Info
{
public static function all()
{
return array_merge(static::versions(), [
static $info = [];
if (! empty($info)) {
return $info;
}
$info = array_merge(static::versions(), [
'api_key' => setting('apps.api_key'),
'ip' => static::ip(),
'companies' => Company::count(),
@ -22,11 +28,19 @@ class Info
'customers' => Contact::customer()->count(),
'php_extensions' => static::phpExtensions(),
]);
return $info;
}
public static function versions()
{
return [
static $versions = [];
if (! empty($versions)) {
return $versions;
}
$versions = [
'akaunting' => version('short'),
'laravel' => InstalledVersions::getPrettyVersion('laravel/framework'),
'php' => static::phpVersion(),
@ -35,6 +49,8 @@ class Info
'livewire' => InstalledVersions::getPrettyVersion('livewire/livewire'),
'omnipay' => InstalledVersions::getPrettyVersion('league/omnipay'),
];
return $versions;
}
public static function phpVersion()