Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 6, 2018
1 parent e72e526 commit 08f8456
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 43 deletions.
61 changes: 20 additions & 41 deletions src/Illuminate/Pagination/AbstractPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ abstract class AbstractPaginator implements Htmlable
*/
protected $path = '/';

/**
* The number of links to display on each side of current page link.
*
* @var int
*/
protected $onEachSide = 3;

/**
* The query parameters to add to all URLs.
*
Expand All @@ -69,6 +62,13 @@ abstract class AbstractPaginator implements Htmlable
*/
protected $pageName = 'page';

/**
* The number of links to display on each side of current page link.
*
* @var int
*/
public $onEachSide = 3;

/**
* The current path resolver callback.
*
Expand Down Expand Up @@ -349,40 +349,6 @@ public function setPageName($name)
return $this;
}

/**
* Set the number of links to display on each side of current page link.
*
* @param int $amount
* @return this
*/
public function linksOnEachSide($amount)
{
return $this->setOnEachSide($amount);
}

/**
* Get the number of links to display on each side of current page link.
*
* @return int
*/
public function getOnEachSide()
{
return $this->onEachSide;
}

/**
* Set the number of links to display on each side of current page link.
*
* @param int $amount
* @return $this
*/
public function setOnEachSide($amount)
{
$this->onEachSide = $amount;

return $this;
}

/**
* Set the base path to assign to all URLs.
*
Expand All @@ -407,6 +373,19 @@ public function setPath($path)
return $this;
}

/**
* Set the number of links to display on each side of current page link.
*
* @param int $count
* @return this
*/
public function onEachSide($count)
{
$this->onEachSide = $count;

return $this;
}

/**
* Resolve the current request path or return the default value.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Pagination/UrlWindow.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function make(PaginatorContract $paginator)
*/
public function get()
{
$onEachSide = $this->paginator->getOnEachSide();
$onEachSide = $this->paginator->onEachSide;

if ($this->paginator->lastPage() < ($onEachSide * 2) + 6) {
return $this->getSmallSlider();
Expand Down
2 changes: 1 addition & 1 deletion tests/Pagination/UrlWindowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testCustomUrlRangeForAWindowOfLinks()
}

$p = new LengthAwarePaginator($array, count($array), 1, 8);
$p->linksOnEachSide(1);
$p->onEachSide(1);
$window = new UrlWindow($p);

$slider = [];
Expand Down

0 comments on commit 08f8456

Please sign in to comment.