I'm currently following Jeff's Episode #16 of Building Forum: https://laracasts.com/series/lets-build-a-forum-with-laravel/episodes/16 and decided to play with pagination a bit more.
I was stuck at pagination where the user filters the thread by username. So I had pagination failing at:
https://forum.app/threads?by=JohnDoe&page=3
Pagination failed because the {{ $threads->links() }} refused to acknowledge the presence of ?by=JohnDoe in the URL and directly linked to forum.app/threads&page=3.
After reading old discussions on stackexchange, I decided to try:
{{ $threads->appends(Request::except('page'))->links() }}
...and voila, it works!
I've no clue why. Can someone tell me what exactly is happening at the 'appends(blah blah) part? I mean, I know it's passing in the request, but how is Laravel handling it?
...also, is that the right way of doing it?
PS: I really appreciate this community and the help fellow members offer. It's super useful and has helped me pace up my learning speed. Thank you, folks! You're awesome.