我在我的 CodeIgniter 设置中使用 Laravel 之外的 Illuminate/database 包。初始化是使用这样的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。我的雄辩 paginate() 已停止工作。eloquent 集合上的 links() 方法给出以下错误。
Call to a member function make() on null
使用堆栈跟踪到
return new HtmlString(static::viewFactory()->make($view ?: static::$defaultView, array_merge($data, [
在vendor\illuminate\pagination\LengthAwarePaginator.php
90 号线
在这方面的任何帮助将不胜感激。