Yes, I will go with a Gate for such a general check, and policy if you need each action to have it's own check.
So something like this: (https://laravel.com/docs/9.x/authorization#writing-gates)
Gate::define('manage-student', function (User $user, Student $student) {
return $user->students()->where('students.id', $student->id)->exists(); // check on the db level
// return $user->students->contains($student->id); -- this is loading all students in memory
});
then to check:
if (Gate::forUser($user)->allows('manage-student', $student)) {
// The teacher can manage the student
}
the $user above is the Teacher in your app.