Esempio n. 1
0
 /**
  * Get paginated model results.
  *
  * @param  int        $per_page
  * @return Paginator
  */
 private function _paginate($per_page = null)
 {
     $total = $this->query->count();
     if (is_null($per_page)) {
         $per_page = property_exists(get_class($this), 'per_page') ? static::$per_page : 20;
     }
     return Paginator::make($this->for_page(Paginator::page($total, $per_page), $per_page)->get(), $total, $per_page);
 }
Esempio n. 2
0
 /**
  * Get paginated query results.
  *
  * @param  int        $per_page
  * @param  array      $columns
  * @return Paginator
  */
 public function paginate($per_page, $columns = array('*'))
 {
     $total = $this->count();
     return Paginator::make($this->for_page(Paginator::page($total, $per_page), $per_page)->get($columns), $total, $per_page);
 }