Store url and uri in session, and just link to where you were.
$areturn = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$haystack = $areturn;
$needle = '?';
$pos = strripos($haystack, $needle);
if ($pos === false) {
$areturn = $areturn."?psch=" . Session::get('dogsearch') . "&aval=" . Session::get('dogaval') . "&page=1" ;
Session::put('areturn', $areturn);
} else {
Session::put('areturn', $areturn);
}
$areturn can now be used in an a href tag. Also works for redirect. If parameters used instead of querystring, just build $areturn with the parameters.
I don't have a quick example from laravel, but here is another way I would do it in Yii2, would be same in laravel:
return $this->redirect(['dog/indexadmin?p=' . Yii::$app->session->get('dogpage') . '&psch=' . Yii::$app->session->get('dogsearch') . '&aval=' . Yii::$app->session->get('dogaval')]);
I prefer this way as I generally code with the what if I have to change frameworks.
I recently converted a cakephp to laravel. Took just a few hours instead of a week.
There were querybuilder differences, but minor.