By the way make sure you are referencing the relationship correctly. A student may have many teachers and A teacher may have many students. so it's a many to many relationship and requires a pivot table.
in the model this should look like
class Teacher extends Model
{
protected $table = 'teachers';
public function students()
{
return $this->belongsToMany(Student::class);
}
}
Then in the Student Model it should look similar to this
class Student extends Model
{
protected $table = 'students';
public function teachers()
{
return $this->belongsToMany(Teacher::class);
}
}
this allows you to get the relationship.
for example
$teacher = Teacher::find(1);
$teacher->students()
or if your wanting to display all students and their relationships
$teachers = Teacher::with('students')->get();
then use a foreach loop and reference the relationship
foreach($teachers as $teacher){
dd($teacher->students());
}
note this relationship is Belongs to Many both ways.
if you put data into your pivot table you should read up about just query it using
$teacher = Teacher::find(1);
foreach($teacher->students() as $student){
echo $student->pivot->fieldname;
}
for more info have a look at eloquent relationships here:
http://laravel.com/docs/5.1/eloquent-relationships#many-to-many
hope that helps