ultimatepos/Modules/AssetExchange/Http/Controllers/DashboardController.php

37 lines
1.0 KiB
PHP

<?php
namespace Modules\AssetExchange\Http\Controllers;
use Illuminate\Routing\Controller;
use Modules\AssetExchange\Http\Controllers\Concerns\AuthorizesAssetExchange;
use Modules\AssetExchange\Services\AssetExchangeDashboardService;
use Modules\AssetExchange\Services\InquirySlaService;
use Modules\AssetExchange\Utils\AssetExchangeUtil;
class DashboardController extends Controller
{
use AuthorizesAssetExchange;
public function __construct(
protected AssetExchangeDashboardService $dashboardService,
protected InquirySlaService $slaService,
protected AssetExchangeUtil $aexUtil
) {
}
public function index()
{
$this->authorizeAexAccess('aex.view');
$business = $this->aexUtil->getBusiness();
if (! $business) {
abort(404);
}
$stats = $this->dashboardService->getKpiStats($business);
$slaSnapshot = $this->slaService->snapshot($business);
return view('assetexchange::dashboard.index', compact('stats', 'slaSnapshot'));
}
}