Skip to content

Instantly share code, notes, and snippets.

@sangar82
Created July 31, 2014 14:47
Show Gist options
  • Select an option

  • Save sangar82/2eb42e67ddc0be45d727 to your computer and use it in GitHub Desktop.

Select an option

Save sangar82/2eb42e67ddc0be45d727 to your computer and use it in GitHub Desktop.
laravel/vendor/league/fractal/src/Pagination\IlluminatePaginatorAdapter.php
/**
* Override method so includes work with pagination
* @param Int $page
* @return String
*/
public function getUrl($page)
{
$parameters = array(
$this->factory->getPageName() => $page,
);
// append the querystring to the pagination links
$queryStrings = array_except( \Input::query(), $this->factory->getPageName() );
$this->appends($queryStrings);
// If we have any extra query string key / value pairs that need to be added
// onto the URL, we will put them in query string form and then attach it
// to the URL. This allows for extra information like sortings storage.
if (count($this->query) > 0)
{
$parameters = array_merge($parameters, $this->query);
}
$fragment = $this->buildFragment();
return $this->factory->getCurrentUrl().'?'.http_build_query($parameters, null, '&').$fragment;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment