修正分页类简洁模式

This commit is contained in:
yunwuxin
2016-05-15 10:37:37 +08:00
parent 19d5b1fee9
commit cf6836b56d
2 changed files with 31 additions and 19 deletions

View File

@@ -53,12 +53,13 @@ abstract class Paginator
$this->simple = $simple;
$this->listRows = $listRows;
$this->items = PaginatorCollection::make($items, $this);
if ($simple) {
if (!$items instanceof Collection) {
$items = Collection::make($items);
}
$this->currentPage = $this->setCurrentPage($currentPage);
$this->hasMore = count($this->items) > ($this->listRows);
$this->items = $this->items->slice(0, $this->listRows);
$this->hasMore = count($items) > ($this->listRows);
$items = $items->slice(0, $this->listRows);
} else {
$this->total = $total;
$this->lastPage = (int)ceil($total / $listRows);
@@ -66,6 +67,7 @@ abstract class Paginator
$this->hasMore = $this->currentPage < $this->lastPage;
}
$this->items = PaginatorCollection::make($items, $this);
}
public function items()