37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
if (!function_exists('themeConfig')) {
|
|
/**
|
|
* Undocumented function
|
|
*
|
|
* @return array
|
|
* @throws \Exception Folder or config file doesn't exist.
|
|
*/
|
|
function themeConfig(): array
|
|
{
|
|
$themeName = tenant()->theme;
|
|
return Cache::remember("config-$themeName", 84600, function () use ($themeName) {
|
|
$themePath = resource_path("theme/$themeName");
|
|
$configFile = "$themePath/theme.config.php";
|
|
|
|
if (!is_dir($themePath)) {
|
|
Log::error("Le dossier du thème [$themeName] est introuvable : $themePath");
|
|
throw new \Exception(
|
|
"Le dossier du thème [$themeName] est introuvable : $themePath"
|
|
);
|
|
}
|
|
|
|
if (!file_exists($configFile)) {
|
|
Log::error("Le fichier de config du thème [$themeName] est introuvable : $configFile");
|
|
throw new \Exception(
|
|
"Le fichier de config du thème [$themeName] est introuvable : $configFile"
|
|
);
|
|
}
|
|
|
|
return require $configFile;
|
|
});
|
|
}
|
|
} //end if
|