I have two tables in MySQL Apoderados
and Alumnos
each with their primary identifier id, then I have another table Apoderado_Alumno
where the id of each table is added, The main idea is that an Attorney can have 1 or more Alumnos and that 1 Alumno can only belong to a Apoderado
I currently have the following relationships in models
ApoderadoAlumno
public function apoderado()
{
return $this->hasOne(Apoderado::class,'apoderado_id');
}
public function alumno()
{
return $this->hasOne(Alumno::class,'id','alumno_id');
}
Is it the correct way? I feel no, do I have to add the relationship to the Student and Teacher models?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2Bbz0UR
via IFTTT
Aucun commentaire:
Enregistrer un commentaire