modules routs

This commit is contained in:
2024-09-18 13:48:12 +03:00
parent f20ba63277
commit 0f26b05443
8 changed files with 67 additions and 37 deletions

View File

@ -77,6 +77,7 @@ class ModuleService
{
$modules = [];
$module_paths = Option::where("key", "module_paths")->first();
$active_modules = Option::where("key", "active_modules")->first();
$dirs = [];
if ($module_paths) {
$path = json_decode($module_paths->value);
@ -85,13 +86,15 @@ class ModuleService
}
}
$active_modules = json_decode($active_modules->value, true);
foreach ($dirs as $dir) {
foreach (new DirectoryIterator($dir) as $fileInfo) {
if($fileInfo->isDot()) continue;
if($fileInfo->isDot() or !in_array($fileInfo->getFilename(), $active_modules['modules'])) continue;
$modules[] = $this->getModuleInfo($fileInfo->getPathname());
}
}
return $modules;
}