Initial implementation of the HomeSysPanel CMS built with Laravel 13.0. Includes complete admin panel, content management, user authentication, modular architecture for products/services/chatbot, and marketing tools. Key features: - User authentication with email verification and password reset - Role-based access control (Admin/User with granular permissions) - Content management (pages, news, FAQ, downloads, galleries, banners) - Contact management system with subjects and responses - Marketing tools (email campaigns, visitor analytics, social sharing) - Modular architecture (Products, Services, Chatbot modules) - AI Chatbot integration with OpenRouter.ai and LlamaCpp support - Visitor tracking with geolocation - SEO optimization with meta tags and Open Graph - Responsive design with Bootstrap 5 - Dark mode support - Maintenance mode - Feature request system
70 lines
1.5 KiB
PHP
Executable File
70 lines
1.5 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Support;
|
|
|
|
use Illuminate\Support\Facades\Config;
|
|
|
|
/**
|
|
* Module Manager
|
|
*
|
|
* Centralized service for checking module availability.
|
|
* Modules are configured in config/modules.php and can be
|
|
* enabled/disabled via .env variables.
|
|
*/
|
|
class ModuleManager
|
|
{
|
|
/**
|
|
* Check if a module is enabled.
|
|
*
|
|
* @param string $module The module identifier (e.g., 'products', 'services')
|
|
* @return bool
|
|
*/
|
|
public function isEnabled(string $module): bool
|
|
{
|
|
$modules = Config::get('modules', []);
|
|
|
|
if (!isset($modules[$module]['enabled'])) {
|
|
return false;
|
|
}
|
|
|
|
$enabled = $modules[$module]['enabled'];
|
|
|
|
// Handle both boolean and string values from env/config
|
|
return filter_var($enabled, FILTER_VALIDATE_BOOLEAN);
|
|
}
|
|
|
|
/**
|
|
* Get all enabled modules.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getEnabledModules(): array
|
|
{
|
|
$modules = Config::get('modules', []);
|
|
|
|
return array_filter($modules, function ($config) {
|
|
return filter_var($config['enabled'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Get all registered modules (enabled or disabled).
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getAllModules(): array
|
|
{
|
|
return Config::get('modules', []);
|
|
}
|
|
|
|
/**
|
|
* Get the list of enabled module identifiers.
|
|
*
|
|
* @return array<string>
|
|
*/
|
|
public function getEnabledModuleNames(): array
|
|
{
|
|
return array_keys($this->getEnabledModules());
|
|
}
|
|
}
|