hello im new for laravel livewire im trying to foreach data to table by date wise.
EXAMPLE I taken attendance on 1/1/24 table header show DATE-1/1/24 AND ROW Show that date record if we not taken attendance on 2/1/24 than table Hader show DATE-2/1/24 AND ROW Show - means attendance not taken
example
| name | STD_ID | DATE-1/1/24 | DATE-2/1/24 | DATE-3/1/24 | DATE-4/1/24 |
| john | STD_01 | P | - | P | A |
| sean | STD_02 | P | - | P | P |
**CONTROLLER**
``
$this->Data= Attendance::get();
//This Code Use For Multiple Coleman Marg In single row by student_id
$grouped = $this->Data->groupBy('student_id');
$this->Attendance_Data = $grouped->all();
``
**BLADE VIEW**
`<table>
<thead>
<tr>
<th>NAME</th>
<th>STD_ID</th>
<th>DATE-1/1/24</th>
<th>DATE-2/1/24</th>
<th>DATE-3/1/24</th>
<th>DATE-......</th>
<th>DATE-31/1/24</th>
</thead>
<tbody>
@foreach ($this->Attendance_Data as $key=>$Attendance_Datas)
<tr>
<td></td>
<td></td>
@foreach ($Attendance_Datas as $key=>$Attendance)
<td> </td>
@endforeach
</tr>
@endforeach
@endif
</tbody>
</table> `
DATABASCE
id | name |student_id | date_of_attendance | attendance |
1 | john | STD_01 | 2024-01-01 | P |
2 | john | STD_01 | 2024-01-03 | P |
2 | john | STD_01 | 2024-01-04 | A |
3 | sean | STD_02 | 2024-01-01 | P |
4 | sean | STD_02 | 2024-01-03 | P |
2 | sean | STD_02 | 2024-01-04 | P |
i tryid in if and else but not get proper result
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3bCGodR
via IFTTT
Aucun commentaire:
Enregistrer un commentaire