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:
@@ -35,6 +35,23 @@ class LayoutHelper
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get domain statistics (centralized function for views)
|
||||
*/
|
||||
public static function getDomainStats(): array
|
||||
{
|
||||
$domainModel = new \App\Models\Domain();
|
||||
$userId = \Core\Auth::id();
|
||||
$settingModel = new \App\Models\Setting();
|
||||
$isolationMode = $settingModel->getValue('user_isolation_mode', 'shared');
|
||||
|
||||
if ($isolationMode === 'isolated') {
|
||||
return $domainModel->getStatistics($userId);
|
||||
} else {
|
||||
return $domainModel->getStatistics();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert timestamp to "time ago" format
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user