added filters in additional edu

This commit is contained in:
F4ilji
2025-04-23 14:23:20 +05:00
parent 8ed4f0f979
commit bd3922c0b5
2 changed files with 9 additions and 1 deletions
@@ -52,6 +52,14 @@ class ClientAdditionalEducationController extends Controller
->has('additionalEducations')
->WithActivePrograms()
->where('is_active', true)
->when($request->input('form'), function ($q, $form) {
$q->whereHas('additionalEducations', function ($q) use ($form) {
$q->where('form_education', FormEducation::fromName($form)->value);
});
})
->when($request->input('category'), function($q, $slugs) {
$q->whereIn('slug', $slugs);
})
->when($request->direction, function ($q, $direction) use ($request) {
return $q->whereHas('direction', fn($query) => $query->where('slug', $direction))
->when($request->form, fn($query, $form) => $query->whereHas('additionalEducations', fn($q) => $q->where('form_education', FormEducation::fromName($form))
@@ -81,7 +81,7 @@ class ClientProgramController extends Controller
->when($request->input('budget'), fn($q, $budget) =>
$this->applyBudgetFilter($q, $budget))
->when($request->input('direction'), fn($q, $slugs) =>
is_array($slugs) ? $q->whereIn('slug', $slugs) : $q)
is_array($slugs) ? $q->whereIn('slug', $slugs) : $q)
->get()
);
});