我按照Laravel文档中的说明进行了 例如,我将 现在我已将类别作为参数传递给视图(其中类别是我抓住了findOrFail的模型) 然后在我看来就是这样: p>
但是当我在分页中的页面之间移动时,此$ category_name值似乎不会持续存在。 什么是推荐的方式来实现我想要的? p>
谢谢。 p>
div> appends([]) code的分页 >但是我对这些参数的持久性有点麻烦。 p>
home?category = Cars& make = Tesla code>传递给 我的看法。 用它们分页获取请求的最佳方法是什么? p>
request('category'); code>) p>
$ category_name = $ category_model-> name;
code> pre>
{{$ vehicles-> appends(['category'=> $ category_name]) - > links()}}
code> pre>
I've followed the instructions on the Laravel documentation for pagination with appends([])
however I'm having a little trouble with the persistence of these parameters.
Say for example, I pass home?category=Cars&make=Tesla
to my view. What is the best way to paginate with them Get requests?
Right now I've passed the category as a parameter to the view as (where category is the model i've grabbed findOrFail with the request('category');
)
$category_name = $category_model->name;
And then in my view it's like so:
{{ $vehicles->appends(['category' => $category_name])->links() }}
But when I go between pages in the pagination, this $category_name value doesn't seem to persist. Whats the recommended way to achieve what I want?
Thanks.