i get a json response like this note i am using GuzzleHttp to call my API
$response = $response->getBody()->getContents();
$output = (json_decode($response));
dd(output)
{#232 ▼
+"current_page": 1
+"data": array:2 [▼
0 => {#230 ▼
+"id": 1
+"test_col": "Test one"
}
1 => {#237 ▼
+"id": 3
+"test_col": "Test three"
}
]
+"first_page_url": "http://api/api/test?page=1"
+"from": 1
+"last_page": 8
+"last_page_url": "http://api/api/test?page=8"
+"next_page_url": "http://api/api/test?page=2"
+"path": "http://api/api/test"
+"per_page": 2
+"prev_page_url": null
+"to": 2
+"total": 15
}
and now when i go to my front end and do this
to get the pagination links it shows me an error
ErrorException (E_ERROR) Call to undefined method stdClass::links()
and on my API side i am doing this
$results = DB::table('test_table')->paginate(2);
return ($results);
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire