【发布时间】:2016-03-14 15:40:26
【问题描述】:
大家好,我正在使用 https://laravelista.com/laravel-custom-pagination-presenter 作为指南创建自定义 Laravel 5 分页演示器,我已按照说明进行操作,但我的应用程序在查找 Illuminate\Pagination\Presenter 类(我从中扩展)时遇到问题。
我正在呼叫我认为的演示者
查看
<div class="cf">
<div class="columns large-6 text-left paginate">
<?php
$presenter = new App\Pagination\Presenters\customPresenter($paginator);
....
我收到的错误是
FatalErrorException in customPresenter.php line 7:
Class 'Illuminate\Pagination\Presenter' not found
我的 CustomPresenter 类看起来像;
<?php
namespace App\Pagination\Presenters;
use Illuminate\Pagination\Presenter;
class customPresenter extends Presenter { << error occurs here
/**
* Get the previous page pagination element.
*
* @param string $text
* @return string
*/
public function getPrevious($text = '<i class="fa fa-angle-left"></i>')
{
// If the current page is less than or equal to one, it means we can't go any
// further back in the pages, so we will render a disabled previous button
// when that is the case. Otherwise, we will give it an active "status".
if ($this->currentPage <= 1)
{
return $this->getDisabledTextWrapper($text);
}
....
我错过了一个包裹吗?我已经完成了作曲家更新并将我的 customPresenter 类添加到自动加载中。
非常感谢任何帮助
干杯
【问题讨论】:
-
看起来这是一个 Laravel 4 教程。 Laravel 5 没有
Illuminate\Pagination\Presenter。见laravel.com/docs/5.2/pagination#manually-creating-a-paginator -
很好的发现,添加它作为答案,我会接受,谢谢
标签: php laravel laravel-5 pagination