In the method get the passed query string parameters if any, example
public function indexAdmin()
{
$dogsearch = !empty(Request::input('psch')) ? Request::input('psch') : '';
$aval = !empty(Request::input('aval')) ? Request::input('aval') : '';
Then a params array can be built:
$params = ['psch' => $dogsearch, 'aval' => $aval];
Pass to view:
return view('dog.index', compact('dogs', 'params'));
And view for paginator:
{{ $dogs->appends($params)->links() }}
The params make querystring like:
somesite.com/dog?page=2$aval=1&psch=ch
// just example
Not sure what your if else is doing.
You have to get the request parameters each time, unless the parameters are a constant for that query.
In example, they are not constant, a user could type r, ro, for rover, or whatever.
Now if I had a query with only "show me the dogs available for adoption" then parameter in url would not be required.
This would work:
$dogs = DB::table('dc_dogs')->where('adopted', '=', 0)->paginate(5);
The only query parameter would be the page=whatever.
'adopted', '=', 0 hard coded in.