$this->sortedQuery( PusatMengundi::query()->with(['election.settings']), ['code', 'name'], 'name' )->paginate(15)->withQueryString(), 'summaryService' => $summaryService, ]); } public function show(PusatMengundi $pusatMengundi, AttendanceSummaryService $summaryService): View { $assignments = StaffAssignment::query() ->with(['application', 'user', 'position', 'saluranMengundi', 'attendance.recordedBy']) ->where('pusat_mengundi_id', $pusatMengundi->id) ->where('status', 'active') ->orderBy('position_id') ->orderBy('saluran_mengundi_id') ->get(); return view('admin.attendance.show', [ 'pusat' => $pusatMengundi->load('election.settings'), 'assignments' => $assignments, 'summary' => $summaryService->totalsForPusat($pusatMengundi), 'roleSummaries' => $summaryService->roleTotalsForPusat($pusatMengundi), ]); } public function export(PusatMengundi $pusatMengundi, Request $request, AttendanceExportService $exportService): StreamedResponse { $exportLog = $exportService->exportPusat($request->user(), $pusatMengundi); return Storage::disk($exportLog->disk ?? 'local') ->download($exportLog->path, $exportLog->file_name); } }