Exemplo n.º 1
0
 /**
  * Paginate the given query into a simple paginator.
  *
  * @param  int  $perPage
  * @param  array  $columns
  * @param  string  $pageName
  * @return \Illuminate\Contracts\Pagination\Paginator
  */
 public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page')
 {
     $page = Paginator::resolveCurrentPage($pageName);
     $perPage = $perPage ?: $this->model->getPerPage();
     $this->skip(($page - 1) * $perPage)->take($perPage + 1);
     return new Paginator($this->get($columns), $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => $pageName]);
 }
 /**
  * Register service provider.
  *
  * @return void
  */
 public function register()
 {
     Paginator::currentPathResolver(function () {
         return $this->app['request']->url();
     });
     Paginator::currentPageResolver(function () {
         return $this->app['request']->input('page');
     });
     $configPath = __DIR__ . '/../config/seo-pagination.php';
     // Merge config to allow user overwrite.
     $this->mergeConfigFrom($configPath, 'seo-pagination');
 }