make() public static method

public static make ( $items = [] )
Esempio n. 1
0
 protected function __construct($items, $listRows, $currentPage = null, $total = null, $simple = false, $options = [])
 {
     $this->options = array_merge($this->options, $options);
     $this->options['path'] = $this->options['path'] != '/' ? rtrim($this->options['path'], '/') : $this->options['path'];
     $this->simple = $simple;
     $this->listRows = $listRows;
     if ($simple) {
         if (!$items instanceof Collection) {
             $items = Collection::make($items);
         }
         $this->currentPage = $this->setCurrentPage($currentPage);
         $this->hasMore = count($items) > $this->listRows;
         $items = $items->slice(0, $this->listRows);
     } else {
         $this->total = $total;
         $this->lastPage = (int) ceil($total / $listRows);
         $this->currentPage = $this->setCurrentPage($currentPage);
         $this->hasMore = $this->currentPage < $this->lastPage;
     }
     $this->items = PaginatorCollection::make($items, $this);
 }