Skip to content

Commit

Permalink
cache the info
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed May 5, 2023
1 parent e33c1ac commit 371ec30
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions app/Utilities/Info.php
Expand Up @@ -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(),
Expand All @@ -22,11 +28,19 @@ public static function all()
'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(),
Expand All @@ -35,6 +49,8 @@ public static function versions()
'livewire' => InstalledVersions::getPrettyVersion('livewire/livewire'),
'omnipay' => InstalledVersions::getPrettyVersion('league/omnipay'),
];

return $versions;
}

public static function phpVersion()
Expand Down

0 comments on commit 371ec30

Please sign in to comment.