本文介绍了手动创建分页器(Laravel 5)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎无法手动创建分页程序的实例.
I seem to be unable to manually create an instance of the paginator.
use Illuminate\Pagination\Paginator;
class Blah {
public function index(Paginator $paginator)
{
// Build array
$var = $paginator->make($array, $count, 200);
return $var;
}
}
从这里我刚得到Unresolvable dependency resolving [Parameter #0 [ <required> $items ]] in class Illuminate\Pagination\Paginator
推荐答案
laravel 5中没有更多的make()方法.您需要创建Illuminate\Pagination\Paginator
或Illuminate\Pagination\LengthAwarePaginator
的实例.查看文档页面, 手动创建分页器 部分
There is no more make() method in laravel 5. You need to create an instance of either an Illuminate\Pagination\Paginator
or Illuminate\Pagination\LengthAwarePaginator
. Take a look at documentation page, Creating A Paginator Manually part
http://laravel.com/docs/master/pagination
我想它看起来像这样:
use Illuminate\Pagination\Paginator;
class Blah {
public function index()
{
// Build array
$array = [];
return new Paginator($array, $perPage);;
}
}
也请检查此答案.
这篇关于手动创建分页器(Laravel 5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!