用新的网址附加当前网址 [英] Appending current url with the new one
问题描述
我有一个使用此URL的请求
I have a request with this URL
expenses?startDate=2019-05-09&endDate=2019-05-15
现在我想要的是将startDate=2019-05-09&endDate=2019-05-15
附加到新的请求URL,以便可以将当前结果转到第二页
now what I wanted is to append the startDate=2019-05-09&endDate=2019-05-15
to the new request URL so that I can go to the second page with the current result
expenses?pages=2&startDate=2019-05-09&endDate=2019-05-15
我尝试了
$builder->latest()->paginate(10)->appends(request()->query());
但是当我单击分页时,它不会追加,因此我只能得到
but when i click to my pagination it is not appending thus I get only
expenses?pages=2
你知道我该怎么实现吗?
any idea how can I achieve this?
PS.我没有使用刀片
PS. im not using blade
推荐答案
我认为您有点困惑. request()->query()
仅在第1页中可用,但之后将为 null .
I think you are little bit confused. request()->query()
will be available only in page 1 but after it will be null.
因此,在get方法中仅获得page
.
So you are getting only the page
in get method.
在您的刀片中尝试以下操作:
In your blade try this:
{{
$paginatorVar->appends(request()->input())->links()
}}
这篇关于用新的网址附加当前网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!