1class Something extends Eloquent {
2
3 protected $table = 'something';
4
5 public function users()
6 {
7 return $this->hasMany('User', 'id_something');
8 }
9}
10
11class User extends Eloquent implements UserInterface, RemindableInterface {
12
13 use UserTrait, RemindableTrait;
14
15 protected $table = 'something_users';
16
17 protected $hidden = array('password', 'remember_token');
18
19 public function something()
20 {
21 return $this->belongsTo('Something', 'id_something');
22 }
23}
1students table
2------------------------------------
3id(PK, A_I) | student_name | nationality
4
5teachers table
6------------------------------------
7id(PK, A_I) | teacher_name | email
8
9classroom table
10----------------------
11id(PK, A_I) | date | teacher_id(FK to teachers.id) | student_id(FK to students.id)
12