Link 3 models in Eloquent

0

I am developing a system that, among other functions, will show the grades of a school, so I must manage levels, courses, subjects, evaluations and grades. Now the subject is the following;

I do not know how I can relate the models of Students, Assessments and Notes, that is, something like this in natural language:

"Each student has evaluations, and each of them has a note"

I have tried many-to-many relationships but finally I can not reach what I'm looking for.

The relationship I am using now is this:

class Alumnos extends Model
{
public function evaluaciones(){
    return 
     $this>belongsToMany('App\Evaluaciones','alumnos_evaluaciones')-
     >withPivot('nota')->orderBy('evaluaciones_id','asc');
}

}

If you come up with an alternative, or someone has already developed this before, I would appreciate it!

    
asked by Felipe Zúñiga Núñez 04.01.2018 в 05:53
source

0 answers