1
I am studying Laravel
and I’m not getting it make/understand how to do join
and present the data. All students who are in a class with the names, class code and description of the final situation.
Model: Turmashasestudantes
public function turmaid()
{
return $this->hasMany(TurmasIdentificacao::class, 'id', 'turma_id');
}
Controller: Turmashasestudantescontroller
$turmax= $turmas_has_estudantes->turmaid;
print_r($turmax->codigo_turma);
Returns the following error:
Property [codigo_turma] does not exist on this Collection instance.
If I remove the ->codigo_turma
I can see all the class data.
I need to get:
turmas_has_estudantes.id, turmas_has_estudantes.turma_id, turmas_has_estudantes.estudante_id,turmas_has_estudantes.situacao_final_id, estudantes_identificacao.nome, turmas_identificacao.codigo_turma, situacao_final.descricao
Luiz needs to put in his question all the classes that are part of this 4 table model! if it is not complicated to answer
– novic