Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nesaathussholeha committed Nov 15, 2024
2 parents 0d34b0e + c4d1eb7 commit 7924d5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions app/Contracts/Repositories/ClassroomStudentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion resources/views/school/pages/class/detail.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class="table border text-nowrap customize-table mb-0 align-middle text-center">
<div class="d-flex flex-wrap justify-content-between align-items-center mb-3">
<form class="mb-2 d-flex col-lg-6 gap-2">
<div class="form-group">
<input type="text" class="form-control" name="search" placeholder="Cari...">
<input type="text" class="form-control" name="name" value="{{ request()->name }}" placeholder="Cari...">
</div>
<button class="btn mb-1 waves-effect waves-light btn-primary" type="button">Cari</button>
</form>
Expand Down

0 comments on commit 7924d5b

Please sign in to comment.