我正在尝试将我的 laravel4 应用程序移植到 laravel 5。在以前的版本中,我可以使用以下方法生成分页 url。
在 Controller 中:
$this->data['pages']= Page::whereIn('area_id', $suburbs)->where('score','>','0')->orderBy('score','desc')->paginate(12);
在与 View 共享数据数组后,我可以用户
在 View 中:
{{$pages->links()}}
在 laravel 5 中,这样做会导致以下错误
ErrorException in AbstractPaginator.php line 445:
call_user_func_array() expects parameter 1 to be a valid callback, class 'Illuminate\Support\Collection' does not have a method 'links'
不确定我在这里缺少什么,有人可以帮忙吗?
最佳答案
在 Laravel 5 中没有方法“链接”你可以试试这个
{!! $pages->render() !!}
关于php - 如何在 laravel 5 中使用分页?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27980373/