Change pagination URL query string
Hello,
Is there a way to parameter name 'query' to another name?
$resuls->nextPageUrl()
generates search?query=test&page=2
How can we change this to tosearch?s=test&page=2
You can use below code to modify the pagination url or query var name also
$result = User::paginate(5);
$result->withPath('http://google.com/s/');
$result->appends('s', 'search string');
$result->setPageName('p');
dd($result->nextPageUrl());
It will generate the below url
"http://google.com/s/?s=search+string&p=2"
You can check this file for more options
\vendor\laravel\framework\src\Illuminate\Pagination\AbstractPaginator.php
Wow
https://drive.google.com/file/d/0B1_PFw--3o74YjVreHNBOWU2aEE/view
$dogsearch = Request::input('psch', 'some_default_value');
$aval = Request::input('aval', 'y');
$params = array('psch' => $dogsearch, 'aval' => $aval);
{{ $dogs->appends($params)->links() }}
Just name parameter whatever you need.
Gives something like
http://whatever_host/dog/indexadmin?psch=c&aval=n&page=2
WRITE one paginator yourself to know how pagination works.
query is not part of the pagination functionality ... it originates from your form
Sorry guys... my bad.. actually I'm using pagination with scout.
Please or to participate in this conversation.