diff --git a/app/Contracts/Repositories/ClassroomStudentRepository.php b/app/Contracts/Repositories/ClassroomStudentRepository.php index c82a71c9..6301af4c 100644 --- a/app/Contracts/Repositories/ClassroomStudentRepository.php +++ b/app/Contracts/Repositories/ClassroomStudentRepository.php @@ -63,11 +63,17 @@ public function whereStudent(mixed $id): mixed public function whereClassroom(mixed $id, Request $request): mixed { return $this->model->query()->where('classroom_id', $id) - ->when($request->search, function ($query) use ($request) { + ->when($request->has('search'), function ($query) use ($request) { $query->whereHas('student.user', function ($query) use ($request) { $query->where('name', 'LIKE', '%' . $request->search . '%'); }); - })->get(); + }) + ->when($request->has('name'), function ($query) use ($request) { + $query->whereHas('student.user', function ($query) use ($request) { + $query->where('name', 'LIKE', '%' . $request->name . '%'); + }); + }) + ->get(); } public function activeStudents(): mixed diff --git a/resources/views/school/pages/class/detail.blade.php b/resources/views/school/pages/class/detail.blade.php index e22ea85c..06fdc826 100644 --- a/resources/views/school/pages/class/detail.blade.php +++ b/resources/views/school/pages/class/detail.blade.php @@ -203,7 +203,7 @@ class="table border text-nowrap customize-table mb-0 align-middle text-center">
- +