Skip to content

Commit

Permalink
Merge pull request #415 from spencer-leopold/master
Browse files Browse the repository at this point in the history
Use Paginator to resolve current page.
  • Loading branch information
mikebronner authored Jan 25, 2022
2 parents b8ffa34 + 7bd18b3 commit 37cb150
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Traits/Buildable.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace GeneaLabs\LaravelModelCaching\Traits;

use Illuminate\Container\Container;
use Illuminate\Pagination\Paginator;

/**
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
Expand Down Expand Up @@ -153,11 +153,7 @@ public function paginate(
return parent::paginate($perPage, $columns, $pageName, $page);
}

$page = Container::getInstance()
->make("request")
->input($pageName)
?: $page
?: 1;
$page = $page ?: Paginator::resolveCurrentPage($pageName);

if (is_array($page)) {
$page = $this->recursiveImplodeWithKey($page);
Expand Down

0 comments on commit 37cb150

Please sign in to comment.