Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2022-01-11 (1 month ago) | | Not yet rated by the users | | Total: 24 This week: 13 | | All time: 10,468 This week: 13 |
|
Description | | Author |
This package can add pagination to listings generated by CakePHP.
It provides a trait that controller classes of CakePHP applications can use to split listings into multiple pages.
Controller class functions that perform queries to retrieve the listing query results can call the trait pagination function.
The trait provides the parameters to extract only the listing rows necessary to display on the current listing page. Innovation Award
January 2022
Nominee
Vote |
Pagination is a common approach many applications use to split long listings between multiple pages.
The logic to split the listings between pages is always the same.
Therefore, this package provides a trait that many PHP applications can reuse based on the CakePHP framework.
This trait helps reduce the time necessary to develop applications with paginated listings.
Manuel Lemos |
| |
|
|
Innovation award
Nominee: 2x
Winner: 1x |
|
Details
CakePHP 3.x JSON Pagination Trait
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());
}
}
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.