It's in the documentation how to append pagination links. Your parameter arrary gets appended.
Jun 19, 2017
3
Level 2
pagination with Laravel using GET
I'm trying to use the paginate method in Laravel but I'm not getting how I'll use paginate when I have parameters passed via GET request.
I would like to have a URL like this: public/pesquisar?profissao=Advogado&distrito=Aveiro and still be able to use paginate.
Search Controller
return view('search.mostrarUsuarios', array('profissoesUser' => $profissoesUser));
Html
<div class="well">
<table class="table">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Link para perfil</th>
<th style="width: 36px;"></th>
</tr>
</thead>
<tbody>
@foreach($profissoesUser as $profissaoUser)
<tr>
<td>{{ $profissaoUser->users->name }}</td>
<td>{{ $profissaoUser->users->last_name }}</td>
<td>{{ $profissaoUser->users->userProfile }}</td>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="pagination text-center">
{{ $profissoesUser->links() }}
</div>
If I click to page 2 it leads me to public/pesquisar?page=2 completly forgeting the distritoand profissao parameter. Is there anyway to solve this problem?
Level 75
2 likes
Please or to participate in this conversation.