Livewire plugin : pagination url error

Hi,

I have a frontend livewire list that is rendered in a component, called with {% livewire 'employelistfilter' user=user %}. It has pagination, added with {{ pager(employes) }} at the end of my loop.

At the top of my list, I have a search text field, among other filter dropdowns.

As soon as I reset the searchbar text field, the pagination url changes from https:/my-domain.com/team?page=2 to https://my-domaine.com/livewire/update?page=2

class EmployeListFilter extends LivewireBase
{
    public $search = "";
    public $contrat_type = "";

    public function render()
    {
        $employees = [];

        $employees = Employe::whereAny([
        'nom',
        'prenom',
        'fonction',
        'localite',
        'initiales',
        ], 'LIKE', '%' . $this->search .'%')
            ->when($this->contrat_type !== "", function ($q) {
                return $q->where('is_temporaire', $this->contrat_type);
            })
        ->actifs()->orderByDesc('is_direction')->orderBy('nom')->orderBy('prenom');

        return \View::make('jan.gestion::livewire.employelistfilter',[
            'employes' => $employees->paginate(25),
            'total' => $employees->count(),
        ]);
    }

}

The search text field looks like that :

<input wire:model.live.debounce.250ms="search" id="search_input" type="search" placeholder="Rechercher" class="form-control" aria-label="Search">

Do you havy any idea why this happens ? Thank a lot for your help.

Hi @Najbo,

You might find this helpful: Laracasts Discussion. It seems to address a similar issue.

Hi @apinard,

Thanks for the interesting link ; I resolved the issue with the url by adding ->setPath('mypath') after ->paginate(25).

But of course, I realize this doesn’t solve the issue when I click on page 2 of the pagination link for example. Of course, I loose every search values because it’s like a new page, with empty values for the search variables.