I'm studying Laravel
and I'm not able to how to join
and display 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 [file_code] does not exist on this collection instance.
If I remove the ->codigo_turma
I can see all the data in the class.
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