Files
ladill-queue/app/Http/Controllers/Qms/AnalyticsController.php
T
isaaccladandCursor cca98eefd2
Deploy Ladill Queue / deploy (push) Successful in 56s
Initial Ladill Queue release — enterprise QMS standalone app.
Phases 1–6: tickets, counters, displays, appointments, workflows, rules, analytics, reports, feedback, admin, device API, and Gitea deploy workflow for queue.ladill.com.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 20:19:52 +00:00

39 lines
1.2 KiB
PHP

<?php
namespace App\Http\Controllers\Qms;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Qms\Concerns\ScopesToAccount;
use App\Models\Branch;
use App\Services\Qms\AnalyticsService;
use App\Services\Qms\OrganizationResolver;
use Illuminate\Http\Request;
use Illuminate\View\View;
class AnalyticsController extends Controller
{
use ScopesToAccount;
public function __construct(
protected AnalyticsService $analytics,
) {}
public function index(Request $request): View
{
$this->authorizeAbility($request, 'reports.view');
$owner = $this->ownerRef($request);
$organization = $this->organization($request);
$branchScope = app(OrganizationResolver::class)->branchScope($this->member($request));
$overview = $this->analytics->overview($owner, $organization->id, $branchScope);
$trend = $this->analytics->dailyTrend($owner, $organization->id, 14, $branchScope);
$branches = Branch::owned($owner)
->where('organization_id', $organization->id)
->orderBy('name')
->get();
return view('qms.analytics.index', compact('overview', 'trend', 'organization', 'branches', 'branchScope'));
}
}