File manager - Edit - /home/webapp69.cm.in.th/u69319090028/Shop/app/Services/AdminDashboardService.php
Back
<?php /** * AdminDashboardService * Aggregates live platform metrics for the admin dashboard */ require_once __DIR__ . '/../Models/User.php'; require_once __DIR__ . '/../Models/Store.php'; require_once __DIR__ . '/../Models/Product.php'; require_once __DIR__ . '/../Models/Order.php'; require_once __DIR__ . '/../Models/Report.php'; require_once __DIR__ . '/../Models/AdminAuditLog.php'; class AdminDashboardService { private User $userModel; private Store $storeModel; private Product $productModel; private Order $orderModel; private Report $reportModel; private AdminAuditLog $auditLogModel; public function __construct() { $this->userModel = new User(); $this->storeModel = new Store(); $this->productModel = new Product(); $this->orderModel = new Order(); $this->reportModel = new Report(); $this->auditLogModel = new AdminAuditLog(); } public function getDashboardData(): array { $userStats = $this->userModel->getPlatformUserStats(); $storeStats = $this->storeModel->getPlatformStoreStats(); $productStats = $this->productModel->getPlatformProductStats(); $orderStats = $this->orderModel->getPlatformOrderStats(); $reportCounts = $this->reportModel->getStatusCounts(); // Recent orders (last 10) $recentOrders = $this->orderModel->getAdminOrders([], 10, 0); // Recent admin actions (last 10) $recentLogs = $this->auditLogModel->getLogs([], 10, 0); return [ 'user_stats' => $userStats, 'store_stats' => $storeStats, 'product_stats' => $productStats, 'order_stats' => $orderStats, 'report_counts' => $reportCounts, 'recent_orders' => $recentOrders, 'recent_logs' => $recentLogs, ]; } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.24 |
proxy
|
phpinfo
|
Settings