You could simply achieve this by adding one or two columns to your table, because all you really need is a way to filter by the term and year.
So if you add the columns term and year you could do..
// Get the student
$student = Student::find(1);
// Get the 2nd term of 2017 with classes and grades
$terms = $student->terms()
->with(['classes', 'grades'])
->where('year', 2017)
->where('term', '2')
->first();
You could also query the Term model to get all students, classes and grades for a specific term.
$term = Term::with['students', 'classes', 'grades'])
->where('year', 2017)
->where('term', '3')
->first();