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')); } }