This commit is contained in:
@@ -314,6 +314,25 @@ class StudentModel extends Model
|
||||
->findAll();
|
||||
}
|
||||
|
||||
public function getByParentAndYear(int $parentId, string $schoolYear): array
|
||||
{
|
||||
$schoolYear = trim($schoolYear);
|
||||
|
||||
if ($parentId <= 0 || $schoolYear === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->select('students.id, students.school_id, students.firstname, students.lastname')
|
||||
->join('student_class', 'student_class.student_id = students.id', 'inner')
|
||||
->where('students.parent_id', $parentId)
|
||||
->where('students.is_active', 1)
|
||||
->where('student_class.school_year', $schoolYear)
|
||||
->groupBy('students.id, students.school_id, students.firstname, students.lastname')
|
||||
->orderBy('students.lastname', 'ASC')
|
||||
->orderBy('students.firstname', 'ASC')
|
||||
->findAll();
|
||||
}
|
||||
|
||||
public function getSchoolIdByStudentId($studentId)
|
||||
{
|
||||
return $this->select('school_id')
|
||||
|
||||
Reference in New Issue
Block a user