を実施しますこの問題と戦うために、私はPHPのurlパーサーヘルパー関数を書いて、URLの中の特定のものを置き換えるために書きました?記号(照会部分)
//for displayPerPage, orderBy and sortBy parse the url and replace with new values
function urlQueryParse($queryToReplace, $newValue){
// extract query from url
$fullUrl = Request::fullUrl();
if(strpos($fullUrl, '?') !== false){
//find everything after the ? in url
$url = substr($fullUrl, strpos($fullUrl, "?") + 1);
// check url to make sure $queryToReplace exists in the url
if(strpos($url, $queryToReplace) !== false) {
// look through the remaining url query and replace whats given to the function
$newUrL = preg_replace('/('. $queryToReplace. '\=)([^&]+)/', $queryToReplace.'='.$newValue, $url);
return Request::url()."?{$newUrL}";
}
// if the ? exists but the queryToReplace is not in the url, then add it to the query string
return Request::url()."?{$url}&{$queryToReplace}={$newValue}";
}
//if the url doesnt have ? sign then simply insert the new value
return Request::url()."?{$queryToReplace}={$newValue}";
}
うまくいけば、これは誰かを助けてくれるでしょう。あなたがそれを改善する方法があるなら、私は提案をすることができます。
P.S.私はLaravel 5.2
に作業しています。ページめくりしようとすると、この$ users = DB :: table( 'users') - > simplePaginate(15);を使用できます。 – EaBangalore
これはビュー – EaBangalore