Skip to content

Commit a37e375

Browse files
author
Ethan
committed
paginate
1 parent 33143eb commit a37e375

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Builder.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,16 +582,19 @@ public function loadDefaultValues($entity = null)
582582

583583
/**
584584
* 分页获取数据
585-
*
586-
* @param int $pageSize 每页数据条数
585+
* @param null $pageSize 每页数据条数
586+
* @param null $currentPage 当前页码,如果不指定,将自动从`$_GET['page']`获取
587587
* @return DataProvider
588588
*/
589-
public function paginate($pageSize = null)
589+
public function paginate($pageSize = null, $currentPage = null)
590590
{
591591
$pageConfig = array();
592592
if ($pageSize !== null) {
593593
$pageConfig['pageSize'] = $pageSize;
594594
}
595+
if ($currentPage !== null) {
596+
$pageConfig['currentPage'] = $currentPage;
597+
}
595598
return new DataProvider($this, $pageConfig);
596599
}
597600

0 commit comments

Comments
 (0)