LMongo\Eloquent\Model::getPerPage PHP Method

getPerPage() public method

Get the number of models to return per page.
public getPerPage ( ) : integer
return integer
    public function getPerPage()
    {
        return $this->perPage;
    }

Usage Example

示例#1
0
 /**
  * Get a paginator for the "select" statement.
  *
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Illuminate\Pagination\Paginator
  */
 public function paginate($perPage = null, $columns = array())
 {
     $perPage = $perPage ?: $this->model->getPerPage();
     $paginator = $this->query->getConnection()->getPaginator();
     // Once we have the paginator we need to set the limit and offset values for
     // the query so we can get the properly paginated items. Once we have an
     // array of items we can create the paginator instances for the items.
     $page = $paginator->getCurrentPage();
     $this->query->forPage($page, $perPage);
     $this->total = true;
     $all = $this->get($columns)->all();
     return $paginator->make($all, $this->total, $perPage);
 }
Model