自定义分页视图在Laravel 5中 [英] Custom pagination view in Laravel 5

查看:73
本文介绍了自定义分页视图在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'

至少在view.php中,此问题在 Laravel 5 中消失了.

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中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆