added offset option
This commit is contained in:
@@ -240,7 +240,7 @@ class Conductor
|
|||||||
$total = $conductor->count();
|
$total = $conductor->count();
|
||||||
|
|
||||||
// Paginate
|
// Paginate
|
||||||
$conductor->paginate($request->input('page', 1), $request->input('limit', -1));
|
$conductor->paginate($request->input('page', 1), $request->input('limit', -1), $request->input('offset', 0));
|
||||||
|
|
||||||
// Limit fields
|
// Limit fields
|
||||||
$limitFields = array_map(function ($field) {
|
$limitFields = array_map(function ($field) {
|
||||||
@@ -478,10 +478,10 @@ class Conductor
|
|||||||
*
|
*
|
||||||
* @param integer $page The current page to return.
|
* @param integer $page The current page to return.
|
||||||
* @param integer $limit The limit of items to include or use default.
|
* @param integer $limit The limit of items to include or use default.
|
||||||
* @param integer $after Start the page count after this count of rows.
|
* @param integer $offset Offset the page count after this count of rows.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
final public function paginate(int $page = 1, int $limit = -1, int $after = 0)
|
final public function paginate(int $page = 1, int $limit = -1, int $offset = 0)
|
||||||
{
|
{
|
||||||
// Limit
|
// Limit
|
||||||
if ($limit < 1) {
|
if ($limit < 1) {
|
||||||
@@ -497,11 +497,11 @@ class Conductor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// After
|
// After
|
||||||
if ($after < 0) {
|
if ($offset < 0) {
|
||||||
$after = 0;
|
$offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->query->offset((($page - 1) * $limit) + $after);
|
$this->query->offset((($page - 1) * $limit) + $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user