'required|string|max_length[9]', ]; // Function to get the final exam score for a specific student, semester, and school year public function getFinalExamScore($studentId, $semester, $schoolYear) { // Query the final_score table for the final exam score based on student ID, semester, and school year $result = $this->select('score') // We only need the score ->where('student_id', $studentId) ->where('semester', $semester) ->where('school_year', $schoolYear) ->first(); // Get the first matching result // Return the score, or null if no result is found return $result ? $result['score'] : null; } }