From 7f483c2e1cb8d4118e03ee3e2f777471709ecdfe Mon Sep 17 00:00:00 2001 From: CLC0609 Date: Mon, 27 Oct 2025 22:25:41 +0000 Subject: [PATCH 1/2] Add ability for examiners to see exams they conducted --- app/Filament/Training/Pages/ExamHistory.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Filament/Training/Pages/ExamHistory.php b/app/Filament/Training/Pages/ExamHistory.php index cf1ef300e..5c3b85098 100644 --- a/app/Filament/Training/Pages/ExamHistory.php +++ b/app/Filament/Training/Pages/ExamHistory.php @@ -41,6 +41,9 @@ public function table(Table $table): Table $examResultRepository = app(ExamResultRepository::class); $query = $examResultRepository->getExamHistoryQueryForLevels($typesToShow); + $query->orWhereHas('examBooking', function ($q) { + $q->where('exmr_id', auth()->user()->id); + }); return $table->query($query)->columns([ TextColumn::make('student.account.id')->label('CID')->searchable(), From a8622cf1b12172a36b67a61042ee95078c3b0480 Mon Sep 17 00:00:00 2001 From: CLC0609 Date: Tue, 4 Nov 2025 09:11:03 +0000 Subject: [PATCH 2/2] Fixed the errors with the filters --- app/Filament/Training/Pages/ExamHistory.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Filament/Training/Pages/ExamHistory.php b/app/Filament/Training/Pages/ExamHistory.php index 5c3b85098..4cf464ac0 100644 --- a/app/Filament/Training/Pages/ExamHistory.php +++ b/app/Filament/Training/Pages/ExamHistory.php @@ -41,8 +41,13 @@ public function table(Table $table): Table $examResultRepository = app(ExamResultRepository::class); $query = $examResultRepository->getExamHistoryQueryForLevels($typesToShow); - $query->orWhereHas('examBooking', function ($q) { - $q->where('exmr_id', auth()->user()->id); + + $query->where(function ($q) use ($typesToShow) { + $q->whereIn('exam', $typesToShow->toArray()); + + $q->orWhereHas('examBooking', function ($qb) { + $qb->where('exmr_id', auth()->id()); + }); }); return $table->query($query)->columns([