you can do this {{ $pages->appends(['query' => 'somepage'])->links() }}
Sep 26, 2019
17
Level 2
Pagination and search
I have standard search function
public function kategorie(Request $request)
{
$query = $request->input('query');
$pages = Page::where('kategoria', 'like', "%$query%")
->orWhere('tags', 'like', "%$query%")
->paginate(10);
return view('kategoria')->with('pages', $pages);
}
in view i have standard laravel pagination
{{ $pages->links() }}
When i use search like:
?query=somepage
Paginaton show me 2 pages, in first it's ok i see 10 search results, but when i wana click second page they show me query
?page=2
and of is 10 reults, but they show all results not only with query "somepage"
how to make results like
?query=somepage&page=2
Level 16
try returning your view like this instead of using with:
return view('kategoria')->compact('pages');
Please or to participate in this conversation.