I am trying to create an auto generated table which is a part of a project I am trying to do. I am trying to create a duty roster for a group of 14 staff. The shifts are as follows :
Shift 1 : 4 staff Shift 2: 4 staff Shift 3: 4 staff Off duty: 2 staff
To ease this process I have assigned a number to each staff, starting from 1 to 14.
Here is the code so far, but it does not work just right.
<table>
<tr>
<th>Shift 1</th>
<th>Shift 2</th>
<th>Shift 3</th>
<th>Off</th>
</tr>
@for ($i = 1; $i <= 30 ; $i++)
<tr>
@for ($j = 1; $j <= 4 ; $j++)
<th>
@if ($j==1)
@for ($h = 1; $h <= 4 ; $h++)
{{ $h }},
@endfor
@endif
@if ($j==2)
@for ($h = 5; $h <= 8 ; $h++)
{{ $h }},
@endfor
@endif
@if ($j==3)
@for ($h = 9; $h <= 12 ; $h++)
{{ $h }},
@endfor
@endif
@if ($j==4)
@for ($h = 13; $h <= 14 ; $h++)
{{ $h }},
@endfor
@endif
</th>
@endfor
</tr>
@endfor
The above code gives me a table as below :
The end goal is to produce something as below : Any help much appreciated. :)