@foreach ($programs as $program)
//Looping to check the total number of Subactivities. If you have hasManyThrough Relation then this is not necessary
@php
$count = 0;
@endphp
@foreach($program->activities as $activity)
@foreach($activity->subactivities as $subactivity)
@php
$count++
@endphp
@endforeach
@endforeach
@php
// Creating a Check for the number of Program
$program_check = 0;
@endphp
@foreach($program->activities as $activity)
@php
// Creating a Check for the number of Activites
$activity_check = 0;
@endphp
@foreach($activity->subactivities as $subactivity)
<tr>
//If number of program is greater than 0 which will increment at the end of subactivity loop then dont display the program again. This check will become 0 again when the next program loop begin. which is the first one
@if ($program_check == 0)
//Your Serial Number Counter. Replace it with your counter.
<td rowspan="{{ $count }}">{{ $counter++ }}</td>
<td rowspan="{{ $count }}">{{ $program->name }}</td>
@endif
//If number of activity greater than 0 which will increment at the end of subactivity loop then dont display the activity again. This check will become 0 again when the next activity loop begin. which is the second one
@if ($activity_check == 0)
<td rowspan="{{ $activty->subactivites->count() }}">{{ $activty->name }}</td>
@endif
<td>{{ $subactivites->name }}</td>
</tr>
@php
$program_check++;
$activity_check++;
@endphp
@endforeach
@endforeach
@endforeach
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}