Custom pagination view in Laravel 5(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 中的自定义分页视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Laravel 5 中的自定义分页视图
基础教程推荐
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何替换eregi() 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
