From f308bf9a7d5b2bf092092ca1df667d69f04d6468 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 2 Feb 2026 22:00:54 +0000 Subject: [PATCH 1/3] Update ExamHistory.php --- app/Filament/Training/Pages/Exam/ExamHistory.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/Filament/Training/Pages/Exam/ExamHistory.php b/app/Filament/Training/Pages/Exam/ExamHistory.php index 6c86d0c8fc..5537d04f33 100644 --- a/app/Filament/Training/Pages/Exam/ExamHistory.php +++ b/app/Filament/Training/Pages/Exam/ExamHistory.php @@ -100,6 +100,22 @@ public function table(Table $table): Table }); })); })->label('Position'), + Filter::make('conducted_by_me')->form([ + Forms\Components\Checkbox::make('conducted_by_me') + ->label('Only show exams I conducted'), + ])->query(function ($query, array $data) { + if ($data['conducted_by_me']) { + $userCid = auth()->user()->id; + return $query->whereHas('examBooking.examiners', function ($q) use ($userCid) { + $q->where(function ($subQuery) use ($userCid) { + $subQuery->whereHas('primaryExaminer', fn ($sq) => $sq->where('cid', $userCid)) + ->orWhereHas('secondaryExaminer', fn ($sq) => $sq->where('cid', $userCid)) + ->orWhereHas('traineeExaminer', fn ($sq) => $sq->where('cid', $userCid)); + }); + }); + } + return $query; + })->label('Conducted by me'), ]); } } From 67b38cbb9a6f92859eca1b09b695e8fab20e1bd2 Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 2 Feb 2026 22:27:58 +0000 Subject: [PATCH 2/3] Fixed linting issue --- app/Filament/Training/Pages/Exam/ExamHistory.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Filament/Training/Pages/Exam/ExamHistory.php b/app/Filament/Training/Pages/Exam/ExamHistory.php index 5537d04f33..3fb53b016b 100644 --- a/app/Filament/Training/Pages/Exam/ExamHistory.php +++ b/app/Filament/Training/Pages/Exam/ExamHistory.php @@ -106,6 +106,7 @@ public function table(Table $table): Table ])->query(function ($query, array $data) { if ($data['conducted_by_me']) { $userCid = auth()->user()->id; + return $query->whereHas('examBooking.examiners', function ($q) use ($userCid) { $q->where(function ($subQuery) use ($userCid) { $subQuery->whereHas('primaryExaminer', fn ($sq) => $sq->where('cid', $userCid)) @@ -114,6 +115,7 @@ public function table(Table $table): Table }); }); } + return $query; })->label('Conducted by me'), ]); From 94f6e23c7e3784b4b4e80f92d0204f72207acc0a Mon Sep 17 00:00:00 2001 From: Daniel 'MrAdder' Green Date: Mon, 2 Feb 2026 23:00:25 +0000 Subject: [PATCH 3/3] Update label for conducted_by_me filter --- app/Filament/Training/Pages/Exam/ExamHistory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Filament/Training/Pages/Exam/ExamHistory.php b/app/Filament/Training/Pages/Exam/ExamHistory.php index 3fb53b016b..6f41bcbc55 100644 --- a/app/Filament/Training/Pages/Exam/ExamHistory.php +++ b/app/Filament/Training/Pages/Exam/ExamHistory.php @@ -102,7 +102,7 @@ public function table(Table $table): Table })->label('Position'), Filter::make('conducted_by_me')->form([ Forms\Components\Checkbox::make('conducted_by_me') - ->label('Only show exams I conducted'), + ->label('Show exams I conducted'), ])->query(function ($query, array $data) { if ($data['conducted_by_me']) { $userCid = auth()->user()->id;