We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当分页中没有上一页时,previous需要返回null;没有下一页时,next需要返回null. 这样可以保持dingo api接口的完整性,调用api返回数据时因为格式固定了,只需判断有没有值即可,方便使用; 建议改为:
if ($currentPage > 1) { $pagination['links']['previous'] = $paginator->getUrl($currentPage - 1); } else { if ($lastPage > 1 && $currentPage == 1) { $pagination['links']['previous'] = null; } } if ($currentPage < $lastPage) { $pagination['links']['next'] = $paginator->getUrl($currentPage + 1); } else { if ($lastPage > 1 && $currentPage == $lastPage) { $pagination['links']['next'] = null; } }
如下图所示,当是第一页并且有多页时,previous应为null,这样返回的分页格式固定不变,变的是数据和值。
The text was updated successfully, but these errors were encountered:
也就是 如果没有上一页,下一页,links为null,其他情况,links的previous,next始终存在。我再想一下
Sorry, something went wrong.
嗯 �对的;好的
eb0346b
No branches or pull requests
当分页中没有上一页时,previous需要返回null;没有下一页时,next需要返回null.
这样可以保持dingo api接口的完整性,调用api返回数据时因为格式固定了,只需判断有没有值即可,方便使用;
建议改为:
如下图所示,当是第一页并且有多页时,previous应为null,这样返回的分页格式固定不变,变的是数据和值。
![image](https://user-images.githubusercontent.com/30611593/31983705-00273668-b924-11e7-91b1-e6e31207f866.png)
The text was updated successfully, but these errors were encountered: