-3
Goodnight
I am trying to make each Tabs present a specific data referring to the name of a person who in my work would be the name of a teacher
I have the following table diaries
id - nomedoprofessor - aluno - diadaaula - resumodaaula
01 - Adriano - Carlos - 2020-01-01 - Fez todas as tarefas
02 - Adriano - Carlos - 2020-01-02 - Faltou a aula
03 - Adriano - Carlos - 2020-01-03 - Chegou atrasado
04 - Adriano - Carla - 2020-01-01 - Teve duvidas mas consegui responder
05 - Adriano - Carla - 2020-01-02 - Não quis fazer exercícios, estava cansada
06 - Adriano - Carla - 2020-01-03 - Foi embora mais cedo
07 - Adriano - Antônio - 2020-01-01 - Fez todas as tarefas
08 - Adriano - Antônio - 2020-01-02 - Fez todas as tarefas
09 - Adriano - Antônio - 2020-01-03 - Faltou por doença
In my controller I have following codes
public function show($professor){
$alunos = DB::table('diarios')
->where('nomedoprofessor','=', $professor)
->orderBy('aluno')
->groupBy('aluno')
->get();
To filter by teacher
in my views professor.blade.php
<ul class="nav nav-tabs" id="myTab" role="tablist">
@foreach ($alunos as $aluno)
<li class="nav-item">
<a class="nav-link" id="home-tab" data-toggle="tab" href="#home-{{$aluno->id}}" role="tab" aria-controls="home-{{$aluno->id}}" aria-selected="true">{{$aluno->aluno}}</a>
</li>
@endforeach
</ul>
<div class="tab-content" id="myTabContent">
@foreach ($alunos as $aluno)
<?php
$conteudo = DB::table('diarios')
->where('nomedoprofessor','=', $aluno->nomedoprofessor)
->where('aluno','=',$aluno->aluno)
->orderBy('aluno')
->get();
?>
<div class="tab-pane fade show" id="home-{{$aluno->id}}" role="tabpanel" aria-labelledby="home-{{$aluno->id}}">
<p>{{$conteudo->diadaaula}} - {{$conteudo->resumodaaula}}</p>
</div>
@endforeach
</div>
But the error is appearing
Property [diadaaula], [resumeroom] does not exist on this Collection instance.
The correct one was to appear as per the image below, can someone please help me.
One idea is to use AJAX
– Renato Junior
Code in the View !!!
– novic