Skip to content

Commit

Permalink
Fixed a minor bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
heera committed Jun 9, 2017
1 parent d9c12b4 commit b3efed8
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/Requent/Traits/QueryBuilderMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ public function fetch($id = null, $columns = ['*'])
public function get($columns = ['*'])
{
if(($perPage = $this->perPage()) || $this->isPaged()) {
$pagination = $this->getQueryStringValue(
$this->getConfigValue('paginator_identifier')
);
return $this->callPaginate($pagination, $perPage, $columns);
return $this->callPaginate($perPage, $columns);
}
return $this->transform($this->builder->get($columns));
}
Expand Down Expand Up @@ -116,19 +113,30 @@ protected function perPage()

/**
* Call the appropriate pagination method
* @param String $pagination Pagination Type
* @param Int $perPage
* @param Array $columns
* @return Mixed
*/
protected function callPaginate($pagination, $perPage, $columns)
protected function callPaginate($perPage, $columns)
{
if($pagination != 'simple') {
if($this->getPaginator() != 'simple') {
return $this->paginate($perPage, $columns);
}
return $this->simplePaginate($perPage, $columns);
}

/**
* Determine the paginator to be used
* @return Array
*/
protected function getPaginator()
{
$paginator = $this->getQueryStringValue(
$this->getConfigValue('paginator_identifier')
);
return $paginator ?: $this->getConfigValue('default_paginator');
}

/**
* Normalize the method parameters
* @param Int $perPage
Expand Down

0 comments on commit b3efed8

Please sign in to comment.