I made an API in Yii2.
Here is my code
$provider = new ActiveDataProvider([
'query' => $model->getReservations($start_time, $end_time),
'pagination' => [
'defaultPageSize' => 2 ,
'pageSize' => 2,
'pageSizeLimit' => [0, 2],
],
]);
$links = $provider->pagination->getLinks();
$count = $provider->getPagination();
return (new ApiResponse)->success(["count" => $count, "links" => $links], ApiResponse::SUCCESSFULL, null);
And the result is:
{
"name": "Success",
"message": "Success",
"code": 200,
"status": "",
"type": "Response",
"models": {
"count": {
"pageParam": "page",
"pageSizeParam": "per-page",
"forcePageParam": true,
"route": null,
"params": null,
"urlManager": null,
"validatePage": true,
"totalCount": 12,
"defaultPageSize": 2,
"pageSizeLimit": [
0,
2
]
},
"links": {
"self": "/backoffice/api/web/index.php/v1/reservations/member/8?page=1"
}
}
}
The problem i am facing is only ‘self’ link is present. Where are the other linkss i-e last, next, previous and first