Level 60
https://laravel.com/docs/8.x/pagination#appending-query-string-values
->paginate(10)->withQueryString();
try this
I have a search and putting the standard pagination, moving to page 2 I lose the search query. so I did this:
{{ $details->appends($_GET)->links('vendor.pagination.bootstrap-4') }}
function getSearchGame(Request $request)
{
$q = strip_tags($request->get('q'));
$games = InfoGiochi::join('giochi', 'info_giochi.id_gioco', '=', 'giochi.id')->where('giochi.nome','LIKE','%'.$q.'%')->groupBy('id_gioco')->orderBy('info_giochi.data','desc')->paginate(10);
if(count($games) > 0) {
return view('front.pages.game.search')->withDetails($games)->withQuery ( $q );
} else {
return view ('front.pages.game.search')->withMessage('Nessun gioco trovato. Riprova!');
}
}
going on the page, however, I receive:
Method Illuminate\Database\Eloquent\Collection::appends does not exist.
how come it? Do you have any ideas? can I indicate my search query with a simple pagination?
https://laravel.com/docs/8.x/pagination#appending-query-string-values
->paginate(10)->withQueryString();
try this
Please or to participate in this conversation.