kield-01/cakephp3-json-pagination
Composer 安装命令:
composer require kield-01/cakephp3-json-pagination
包简介
JSON Pagination trait for CakePHP 3.x
README 文档
README
Badges
Installation
composer require kield-01/cakephp3-json-pagination && composer dump-autoload -o
How to use?
In Your AppController, You must add use JsonPaginationTrait to use the trait application-wide:
class AppController extends Controller
{
use JsonPaginationTrait;
}
Or You could add it only to the controller You want:
class UsersController extends Controller
{
use JsonPaginationTrait;
}
How to get the data?
At first, You should load Your model, which You want to use with JsonPaginationTrait or to use autoloaded by the classname:
class UsersController extends Controller
{
use JsonPaginationTrait;
public function index()
{
/** If You want to use custom alias, You should pass second argument **/
return $this->j_paginate($this->Users->find(), $this->Users->getTable());
/** Regular response with classic data alias **/
return $this->j_paginate($this->Users->find());
}
}
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2018-03-04