Sep 28, 2015
0
Level 2
access jason results data using blade
i want to get timesheets for a specific date and load all the shifts of each users.
below is my json output which igot thru join tables
[
{
"id": 1,
"user_id": 15,
"role_id": 1,
"week_id": 1,
"date": "2015-09-29",
"day_total_hours": "0",
"signature": null,
"created_at": "2015-05-26 03:32:28",
"updated_at": "2015-05-26 03:32:28",
"shift": [
{
"id": 1,
"user_id": 15,
"role_id": 1,
"time_sheets_id": 1,
"bus_no": "701",
"reg_no": "ZWE528",
"shift_no": 1,
},
{
"id": 2,
"user_id": 15,
"role_id": 1,
"time_sheets_id": 1,
"bus_no": "701",
"reg_no": "ZWE528",
"shift_no": 2,
},
{
"id": 3,
"user_id": 15,
"role_id": 1,
"time_sheets_id": 1,
"bus_no": "701",
"reg_no": "ZWE528",
"shift_no": 3,
}
],
"user": [
{
"id": 1,
"full_name": "Admin one",
"username": "steve",
"email": "admin1@testing.com",
}
]
},
```
blade file
@foreach( $Timesheets as $timesheet)
<div class="col-sm-3"> {{ $timesheet->username }}</div>
<div class="col-sm-3">{{ $timesheet->date }}</div>
<div class="col-sm-3">Total Hours: {{ $timesheet->day_total_hours }}</div>
<div class="col-sm-2"> <span class="glyphicon glyphicon-eye-open"></span></div>
<div class="col-sm-1"> <span class="glyphicon glyphicon-chevron-down"></span></div>
//load shifts for specific timesheets @foreach( $Timesheets as $shifts) {{ $shifts->week_id }} {{ $shifts->bus_no }} {{ $shifts->reg_no }} @endforeach
@endforeach
please advice me how to access shift and user data using blade ..
Please or to participate in this conversation.