Framework: Paginator Uses Incorrect Template

Created on 16 Feb 2018  路  6Comments  路  Source: laravel/framework

  • Laravel Version: 5.6.0
  • PHP Version: 7
  • Database Driver & Version: Irrelevant

Description:

In the documentation for Pagination, under Customizing the Paginator View it says:
"This command will place the views in the resources/views/vendor/pagination directory. The default.blade.php file within this directory corresponds to the default pagination view. Simply edit this file to modify the pagination HTML."

However upon editing default.blade.php it will not update the pagination HTML. This is because the incorrect view(s) is called in IlluminatePaginatorAbstractPaginator class:
~~~
/**
* The default pagination view.
*
* @var string
*/
public static $defaultView = 'pagination::bootstrap-4';

/**
 * The default "simple" pagination view.
 *
 * @var string
 */
public static $defaultSimpleView = 'pagination::simple-bootstrap-4';

~~~
You must edit boostrap-4.blade.php instead. This should be changed to default.blade.php as the documentation states and to avoid opinionated decisions about specific UI frameworks should Laravel use a different HTML structure in the future.

All 6 comments

Confirmed. After upgrading to 5.6 my resources/views/vendor/pagination/default.blade.php stopped being used.

Just needs to be clarified in the docs. This was a recent change.

There are 2 solutions:

Option 1: Rename your pagination/default.blade.php to pagination/bootstrap-4.blade.php (could be confusing if you're not really using Bootstrap though)
Option 2: Add Paginator::defaultView('pagination::default'); to a service provider

In my case, I'm using UIKit so now I'm using Paginator::defaultView('pagination::uikit'); with a pagination/uikit.blade.php

This has also confused me. Why would default not be the default view it is using?

Upgrade guide only said it changed the template to BS4 but I thought it would just be updating default.blade.php (which I already override by publishing the vendor views).

Think I'll do what @fitztrev has said and make sure it always uses a certain view. Thanks.

This been updated in docs then?

I don't know, if it hasn't please make a PR to the docs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iivanov2 picture iivanov2  路  3Comments

felixsanz picture felixsanz  路  3Comments

jackmu95 picture jackmu95  路  3Comments

kerbylav picture kerbylav  路  3Comments

shopblocks picture shopblocks  路  3Comments