雄辩5.5分页()不在laravel外工作

时间:2018-04-21 05:53:24

标签: laravel eloquent laravel-5.5 illuminate-container

我在Laravel之外使用Illuminate /数据库包和我的CodeIgniter设置。初始化是使用Capsule类完成的,如此

use Illuminate\Database\Capsule\Manager as CapsuleManager;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;

class Capsule extends CapsuleManager
{
public function __construct()
{
    parent::__construct();

    require_once __DIR__.'/../config/database.php';
    $db = (object) $db['default'];

    $this->addConnection(array(
        'driver'    => 'mysql',
        'host'      => $db->hostname,
        'database'  => $db->database,
        'username'  => $db->username,
        'password'  => $db->password,
        'charset'   => $db->char_set,
        'collation' => $db->dbcollat,
        'prefix'    => $db->dbprefix,
    ));

    $this->setEventDispatcher(new Dispatcher(new Container));

    // Make this Capsule instance available globally via static methods... (optional)
    $this->setAsGlobal();

    // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
    $this->bootEloquent();
}
}

我让它在illuminate/database 5.2上运行。最近我将其更新为illuminate/database 5.5。我的Eloquent paginate()已经停止工作了。 eloquent collection上的links()方法会产生以下错误。

Call to a member function make() on null

使用堆栈跟踪

return new HtmlString(static::viewFactory()->make($view ?: static::$defaultView, array_merge($data, [

在第90行的vendor\illuminate\pagination\LengthAwarePaginator.php

在这方面的任何帮助将不胜感激。

0 个答案:

没有答案