I have this code in my trips.blade.php. The problem is when my $t->employees is outside the modal, I retrieve all my employees but when I put my $t->employees inside my modal, I can only retrieve 1 Data. I can't figure out any error in this scenario.
@foreach($trips as $t)
<tr>
<td>{{$t->id}}</td>
<td>{{$t->dateMilled_trip}}</td>
<td>{{$t->ticket->ticketNumber_ticket}}</td>
<td>{{$t->truckNumber_trip}}</td>
<td>{{$t->finalWeight_trip}}</td>
<td>
{{$t->employees}} -> Here it shows all the employees inside trip
<a class="btn btn-info btn-xs" data-toggle="modal" data-target="#viewEmployeesAttendanceTicket">View Employees Attendance</a>
<!-- Modal -->
<div class="modal fade" id="viewEmployeesAttendanceTicket" tabindex="-1" role="dialog" aria-labelledby="James Order List">
<div class="modal-dialog" role="document">
<div class="modal-content">
{{$t->employees}} ->Here it show only 1 employee data
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">{{$t->ticket->ticketNumber_ticket}} Attendances</h4>
</div>
<div class="modal-body">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Employee Name</th>
</tr>
</thead>
<tbody>
@foreach($t->employees as $emp) ->same here [1 Data only]
<tr>
<td>{{$emp->id}}</td>
<td>{{$emp->name_employee}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</td>
<td>
<div class="btn-group" role="group" aria-label="...">
<a class="btn btn-danger btn-xs">DELETE</a>
</div>
</td>
</tr>
@endforeach
Screenshot