I am working on the below code, where the same question can have multiple images as an answer.
So, they are displaying properly but, with every image, the same question is repeating multiple times.
So, I want the question to display only once and below that the answers should be displayed. Below is the code. I have created a table and the images will be displayed after the question. Same has been highlighted below. I have done some POC, please have a look.
<!--Question and Answer Section Open-->
@if($submited_documents->count() !=0)
<table class="table table-bordered">
<tbody>
@if(count($submited_documents) > 0)
@foreach($submited_documents as $documents)
<tr>
<th style="width:50% !important; border:1px solid lightgray;"><strong>Question{{$documents->sequence}} : </strong></th>
<th style="border:1px solid lightgray; "><strong>Answer : </strong></th>
</tr>
<tr>
<td>{{ $documents->question }}</td>
<td>{{ $documents->comments }}</td>
</tr>
@endforeach
@endif
</tbody>
</table>
<table>
<tbody>
@foreach($submited_documents as $documents)
<tr>
<td style="border-radius: 2px;">
<strong>Question{{$documents->sequence}} : </strong>{{ $documents->question }}
</td>
</tr>
@if(count($documents->pictures) > 0 )
@foreach($documents->pictures as $document_picture)
<tr>
<td class="td_class">
@if($document_picture->filename != null)
<a style="" href="{{ URL::to('public/uploads/pickups/'.$document_picture->filename) }}" target="new">
<img src="{{ URL::to('public/uploads/pickups/'.$document_picture->filename) }}"
alt="{{ $document_picture->filename }}" title="{{ $document_picture->filename }}"
style="width: 50% !important;height: 50% !important;" ></a><br>
@endif
</td>
</tr>
@endforeach
@endif
@endforeach
</tbody>
</table>
@endif
<!--Question and Answer Section End-->
Any help is appreciated..