fix db tables to have school year
This commit is contained in:
@@ -19,7 +19,6 @@ class StudentModel extends Model
|
||||
'photo_consent',
|
||||
'is_new',
|
||||
'parent_id',
|
||||
'school_year',
|
||||
'registration_date',
|
||||
'tuition_paid',
|
||||
'year_of_registration',
|
||||
@@ -122,7 +121,9 @@ class StudentModel extends Model
|
||||
|
||||
// school_year filter (skip if null or "all")
|
||||
if ($schoolYear !== null && strtolower($schoolYear) !== 'all') {
|
||||
$builder->where('students.school_year', $schoolYear);
|
||||
$builder
|
||||
->join('student_class sc_filter', 'sc_filter.student_id = students.id', 'inner')
|
||||
->where('sc_filter.school_year', $schoolYear);
|
||||
}
|
||||
|
||||
return $builder
|
||||
@@ -171,12 +172,13 @@ class StudentModel extends Model
|
||||
users.cellphone as phone,
|
||||
students.registration_grade,
|
||||
classSection.class_section_name as current_class,
|
||||
"' . $schoolYear . '" as school_year,
|
||||
student_class.school_year,
|
||||
"' . $semester . '" as semester
|
||||
')
|
||||
->join('users', 'users.id = students.parent_id', 'left')
|
||||
->join('student_class', 'student_class.student_id = students.id', 'left')
|
||||
->join('class_section', 'student_class.class_section_id = classSection.id', 'left')
|
||||
->join('classSection', 'student_class.class_section_id = classSection.class_section_id', 'left')
|
||||
->where('student_class.school_year', $schoolYear)
|
||||
->get()
|
||||
->getResultArray();
|
||||
}
|
||||
@@ -199,7 +201,7 @@ class StudentModel extends Model
|
||||
')
|
||||
->join('student_class', 'students.id = student_class.student_id', 'left')
|
||||
->join('teacher_class', 'student_class.class_section_id = teacher_class.class_section_id', 'left')
|
||||
->join('class_section', 'student_class.class_section_id = classSection.id', 'left')
|
||||
->join('classSection', 'student_class.class_section_id = classSection.class_section_id', 'left')
|
||||
->where('teacher_class.teacher_id', $teacherId)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
Reference in New Issue
Block a user