Custom Paginator - Disable or Rename Page QueryString

Here is a trait you can stick in your project somewhere to use instead of the default WithPagination if you need the added functionality.

<?php

namespace App\Traits\Livewire;

use Illuminate\Pagination\Paginator;

trait WithPaginationExtended
{
    public $page = 1;

    public function isQueryStringEnabled()
    {
        if (property_exists($this, 'paginationQueryStringEnabled')) {
            return $this->paginationQueryStringEnabled;
        }
        return true;
    }

    public function getUpdatesQueryString()
    {
        if ($this->isQueryStringEnabled()) {
            return array_merge([$this->paginationQueryString], $this->updatesQueryString);
        }
    }

    public function initializeWithPaginationExtended()
    {
        if (!property_exists($this, 'paginationQueryString')) {
            $this->paginationQueryString = 'page';
        }

        $this->{$this->paginationQueryString} = 1;

        // The query string item should only be available
        // from within the original component mount run.
        if ($this->isQueryStringEnabled()) {
            $this->{$this->paginationQueryString} = request()->query(
                $this->paginationQueryString,
                $this->{$this->paginationQueryString}
            );
        }

        Paginator::currentPageResolver(function () {
            return $this->{$this->paginationQueryString};
        });

        Paginator::defaultView($this->paginationView());
    }

    public function paginationView()
    {
        return 'livewire::pagination-links';
    }

    public function previousPage()
    {
        $this->{$this->paginationQueryString} = $this->{$this->paginationQueryString} - 1;
    }

    public function nextPage()
    {
        $this->{$this->paginationQueryString} = $this->{$this->paginationQueryString} + 1;
    }

    public function gotoPage($page)
    {
        $this->{$this->paginationQueryString} = $page;
    }
}

To disable the query string parameter:
protected $paginationQueryStringEnabled = false;

To rename the parameter you have to declare it, and then assign it:
public $differentPage;
protected $paginationQueryString = 'differentPage';

I am using Livewire 2.0. Its not properly for me.

I haven’t looked at this in a while, did you get it to work or can you explain what’s not working/errors you are getting?