select('score') // We only need the score ->where('student_id', $studentId) ->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; } }