<table>
<thead>
<tr style="font-size: 16px;">
<th>approval_no</th>
<th>pnr</th>
<th>airline</th>
<th>cost</th>
<th>collected</th>
<th>due_date</th>
<th>time_limit</th>
<th>notes</th>
<th>approve_laststatus</th>
<th>customer</th>
<th>supplier</th>
<th>created_by</th>
<th>created_at</th>
<th>Assignee</th>
<th>Ticket Number</th>
<th>Created By</th>
<th>created_at</th>
<th>EMD Number</th>
<th>Created By</th>
<th>created_at</th>
<th>Invoice Number</th>
<th>Created By</th>
<th>created_at</th>
</tr>
</thead>
<tbody>
@foreach($approvals as $approval)
<tr>
<td>{{ $approval->approval_no }}</td>
<td>{{ $approval->pnr }}</td>
<td>{{ $approval->airline->airline }}</td>
<td>{{ $approval->cost }}</td>
<td>{{ $approval->collected }}</td>
<td>{{ date("m/d/Y", strtotime($approval->due_date))}}</td>
<td>{{ date("m/d/Y", strtotime($approval->time_limit))}}</td>
<td>{{ $approval->notes }}</td>
<td>{{ $approval->approve_laststatus}}</td>
<td>{{ $approval->customer->customer_name}}</td>
<td>{{ $approval->supplier->supplier_name}}</td>
<td>{{ $approval->creator->first_name}}</td>
<td>{{ date("m/d/Y", strtotime($approval->created_at))}}</td>
<td>{{$approval->assignee}}</td>
</tr>
@if(!empty($approval->tickets))
@foreach($approval->tickets as $ticket)
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td>{{ $ticket->ticket_number }}</td>
<td>{{ $ticket->creator->first_name}}</td>
<td>{{ date("m/d/Y", strtotime($ticket->created_at))}}</td>
</tr>
@endforeach
@endif
@if(!empty($approval->emd))
@foreach($approval->emd as $emd)
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td>{{ $emd->emd_number }}</td>
<td>{{ $emd->creator->first_name}}</td>
<td>{{ date("m/d/Y", strtotime($emd->created_at))}}</td>
</tr>
@endforeach
@endif
@if(!empty($approval->invoices))
@foreach($approval->invoices as $invoice)
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td>{{ $invoice->invoice_number }}</td>
<td>{{ $invoice->creator->first_name}}</td>
<td>{{ date("m/d/Y", strtotime($invoice->created_at))}}</td>
</tr>
@endforeach
@endif
@endforeach
</tbody>
</table>
Im loading relationship data using laravel export to excel, This is the current code I'm using to show the data in the Excel sheet, I'm using laravel view to get the output. Attached is the output, the nested data print on one row down.
Related data coloured in the same colour.
How can I get the related data to start on the same row?
