本文介绍了Laravel 5 中的自定义分页视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Laravel 4.2 可以选择在 app/config/view.php
中指定自定义视图,例如:
Laravel 4.2 has the option to specify a custom view in app/config/view.php
such as:
/*
|--------------------------------------------------------------------------
| Pagination View
|--------------------------------------------------------------------------
|
| This view will be used to render the pagination link output, and can
| be easily customized here to show any view you like. A clean view
| compatible with Twitter's Bootstrap is given to you by default.
|
*/
'pagination' => 'pagination_slider-alt'
这在 Laravel 5 中消失了,至少在 view.php
方面是这样.
This is gone in Laravel 5 at least regarding view.php
.
有没有办法在 Laravel 5 中复制这种行为?
Is there a way to replicate this behavior in Laravel 5?
推荐答案
而在 Laravel 4.2 中我会使用:
{{ $users->links('view.name') }}
在 Laravel 5 中,您可以使用以下内容复制上述内容:
In Laravel 5 you can replicate the above with the following:
@include('view.name', ['object' => $users])
现在在包含的视图中,$object
将有可用的分页方法,例如 currentPage()
、lastPage()
、perPage()
等
Now in the included view, $object
will have the pagination methods available, such as currentPage()
, lastPage()
, perPage()
, etc.
您可以在 http://laravel.com/docs/5.0/pagination
这篇关于Laravel 5 中的自定义分页视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!