fix apply the plan docs/alrahma_api_fix_plan_school_year_only_v7
API CI/CD / Validate (composer + pint) (push) Successful in 3m10s
API CI/CD / Test (PHPUnit) (push) Failing after 6m49s
API CI/CD / Build frontend assets (push) Successful in 1m3s
API CI/CD / Security audit (push) Failing after 1m0s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m10s
API CI/CD / Test (PHPUnit) (push) Failing after 6m49s
API CI/CD / Build frontend assets (push) Successful in 1m3s
API CI/CD / Security audit (push) Failing after 1m0s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -24,6 +24,29 @@ class StaffQueryService
|
||||
$query->whereRaw('LOWER(active_role) = ?', [$role]);
|
||||
}
|
||||
|
||||
$schoolYear = (string) ($filters['school_year'] ?? $this->configService->getSchoolYear() ?? '');
|
||||
if ($schoolYear !== '') {
|
||||
$query->where('school_year', $schoolYear);
|
||||
}
|
||||
|
||||
if (! empty($filters['status'])) {
|
||||
$status = strtolower(trim((string) $filters['status']));
|
||||
if ($status === 'inactive') {
|
||||
$query->whereRaw('LOWER(active_role) = ?', ['inactive']);
|
||||
} elseif ($status === 'active') {
|
||||
$query->whereRaw('LOWER(active_role) != ?', ['inactive']);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($filters['search'])) {
|
||||
$search = '%'.strtolower(trim((string) $filters['search'])).'%';
|
||||
$query->where(function ($inner) use ($search) {
|
||||
$inner->whereRaw('LOWER(firstname) LIKE ?', [$search])
|
||||
->orWhereRaw('LOWER(lastname) LIKE ?', [$search])
|
||||
->orWhereRaw('LOWER(email) LIKE ?', [$search]);
|
||||
});
|
||||
}
|
||||
|
||||
$sortBy = $filters['sort_by'] ?? 'created_at';
|
||||
$sortDir = strtolower((string) ($filters['sort_dir'] ?? 'desc')) === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
@@ -31,7 +54,6 @@ class StaffQueryService
|
||||
->orderBy($sortBy, $sortDir)
|
||||
->paginate($perPage, ['*'], 'page', $page);
|
||||
|
||||
$schoolYear = (string) ($filters['school_year'] ?? $this->configService->getSchoolYear() ?? '');
|
||||
$semester = (string) ($filters['semester'] ?? $this->configService->getSemester() ?? '');
|
||||
|
||||
$assignByTeacher = $this->buildAssignments($schoolYear);
|
||||
|
||||
Reference in New Issue
Block a user