@jvbalcita if I understand you properly, you want to access student data from the teacher model.
In that case, you just simply use dot notation for Nested Eager Loading to access.
For example-
Teacher::with('courses.students')->get()
Ref: https://laravel.com/docs/7.x/eloquent-relationships#eager-loading