0
Good morning, I will try to simplify my difficulty, however any extra doubt I will be available to provide any code information...
I have a filter whose which I do my searches for certain values and at the end I have a paginate value:
<div class="form-group col-md-12 col-sm-12 col-xs-12">
<div class="col-md-2 col-sm-2 col-xs-2 form-label">
{{Form::label('poder', 'Poder')}}
</div>
<div class="col-md-10 col-sm-10 col-xs-10">
{{Form::select('poder', $poder, null, ['class' => 'form-control'])}}
</div>
</div>
<div class="form-group col-md-12 col-sm-12 col-xs-12">
<div class="col-md-2 col-sm-2 col-xs-2 form-label">
{{Form::label('unidade', 'Unidade')}}
</div>
<div class="col-md-10 col-sm-10 col-xs-10">
{{Form::select('unidade', $unidade, null, ['class' => 'form-control'])}}
</div>
</div>
<div class="form-group col-md-12 col-sm-12 col-xs-12">
{{Form::label('perPage', 'Deseja filtrar quantos resultados por página?', ['class' => 'pagilabel'])}}
{{Form::number('perPage', null, ['class' => 'paginumber', 'min' => 0])}}
{{Form::submit('Localizar', ['class' => 'btn btn-info'])}}
</div>
In my controller I have the following:
if ($request->poder) $query->where('orgao.poderId', $request->poder);
if ($request->unidade) $query->where('unid.id', $request->unidade);
$table = $query->paginate($request->perPage ? $request->perPage : 20);
I determined a default value of 20 results per page by paginate, everything works perfectly....
My difficulty is...: When I have a certain result filtered, when changing page by paginate the request is canceled and shows all the records of my respective table, as if my filter was canceled and the page updated.
My question is...: How do I send the same request made by the form every time I change the page of the paginate?
Grateful from now on !
Mine is with appends and still doesn’t work, like this...{$table->appends(['perPage' => $perPage])->links()}}
– Lincoln Binda
Resolver...http://stackoverflow.com/questions/38267498/paginate-update-request/38274616#38274616
– Lincoln Binda