I am getting a response from an api that sends an encoded paginated response I am receiving the response and decoded it the response is
{#225 ▼
+"message": "تم بنجاح"
+"code": "1"
+"data": {#220 ▼
+"current_page": 1
+"data": array:10 [▶]
+"from": 1
+"last_page": 2
+"next_page_url": "http://localhost:8000/api/getpostsadmin?page=2"
+"path": "http://localhost:8000/api/getpostsadmin"
+"per_page": 10
+"prev_page_url": -1
+"to": 10
+"total": 11
}
}
this is the rest of the code in the controller
if ($response->code=='1')
{
// dd($response->data);
$data=$response->data;
//
// dd($data);
return view('posts',compact('data'));
}
and this is the code in the view
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>ID</th>
<th>Title AR</th>
<th>Title EN</th>
<th>Description AR</th>
<th>Description EN</th>
<th>Created At</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>Title AR</th>
<th>Title EN</th>
<th>Description AR</th>
<th>Description EN</th>
<th>Created At</th>
</tr>
</tfoot>
<tbody>
@foreach($data->data as $datum)
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
@endforeach
</tbody>
</table>
{!! $data->links() !!}
</div>
please help me why this error is always appearing?? i tried render() method instead and {!! $data->data->links() !!} but nothing worked I need a solution not a vote down
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire