Centralize domain stats retrieval in LayoutHelper
Moved domain statistics logic into a new LayoutHelper::getDomainStats() method. Updated base layout and dashboard view to use this helper, reducing code duplication and improving maintainability.
This commit is contained in:
@@ -3,6 +3,12 @@ $title = 'Dashboard';
|
||||
$pageTitle = 'Dashboard Overview';
|
||||
$pageDescription = 'Monitor your domains and expiration dates';
|
||||
$pageIcon = 'fas fa-chart-line';
|
||||
|
||||
// Get stats for dashboard (if not already set by base.php)
|
||||
if (!isset($stats)) {
|
||||
$stats = \App\Helpers\LayoutHelper::getDomainStats();
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
@@ -262,7 +268,6 @@ ob_start();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
include __DIR__ . '/../layout/base.php';
|
||||
|
||||
@@ -19,15 +19,7 @@ if ($userId) {
|
||||
|
||||
// Get stats for sidebar (available on all pages)
|
||||
if (!isset($stats)) {
|
||||
$domainModel = new \App\Models\Domain();
|
||||
$settingModel = new \App\Models\Setting();
|
||||
$isolationMode = $settingModel->getValue('user_isolation_mode', 'shared');
|
||||
|
||||
if ($isolationMode === 'isolated') {
|
||||
$stats = $domainModel->getStatistics($userId);
|
||||
} else {
|
||||
$stats = $domainModel->getStatistics();
|
||||
}
|
||||
$stats = \App\Helpers\LayoutHelper::getDomainStats();
|
||||
}
|
||||
|
||||
// Get application settings from database
|
||||
|
||||
Reference in New Issue
Block a user