Laravel 5.5 Mongo 数据库错误
Laravel 5.5 Mongo DB error
我正在 Laravel 5.5 中开发一个 Mongo 数据库应用程序。但是在包 https://github.com/jenssegers/laravel-mongodb 中出现以下错误。
Declaration of
Jenssegers\Mongodb\Eloquent\HybridRelations::belongsToMany($related,
$collection = NULL, $foreignKey = NULL, $otherKey = NULL, $relation =
NULL) should be compatible with
Illuminate\Database\Eloquent\Model::belongsToMany($related, $table =
NULL, $foreignPivotKey = NULL, $relatedPivotKey = NULL, $parentKey =
NULL, $relatedKey = NULL, $relation = NULL)
以下是我执行的步骤。
- 安装了 Mongo 数据库及其 php 扩展。
- 安装了这个 Laravel 包。
- 添加了服务提供商
- 已配置的数据库
- 创建模型
- 最后
$user = DB::connection('mongodb')->collection('users')->get();
据我所知,Laravel 5.5 已经更改了 belongsToMany
方法的签名,所以你应该等到这个包与 Laravel 5.5 兼容,我看到关于这个的问题已经创建这里:https://github.com/jenssegers/laravel-mongodb/issues/1279
此问题现已修复。请检查此 file。使用此修复程序覆盖本地文件解决了问题。
今天发布了一个支持 laravel 5.5、运行 存储库更新的版本。
在 composer 中使用版本 3.3 "jenssegers/mongodb": "3.3.*"
我正在 Laravel 5.5 中开发一个 Mongo 数据库应用程序。但是在包 https://github.com/jenssegers/laravel-mongodb 中出现以下错误。
Declaration of Jenssegers\Mongodb\Eloquent\HybridRelations::belongsToMany($related, $collection = NULL, $foreignKey = NULL, $otherKey = NULL, $relation = NULL) should be compatible with Illuminate\Database\Eloquent\Model::belongsToMany($related, $table = NULL, $foreignPivotKey = NULL, $relatedPivotKey = NULL, $parentKey = NULL, $relatedKey = NULL, $relation = NULL)
以下是我执行的步骤。
- 安装了 Mongo 数据库及其 php 扩展。
- 安装了这个 Laravel 包。
- 添加了服务提供商
- 已配置的数据库
- 创建模型
- 最后
$user = DB::connection('mongodb')->collection('users')->get();
据我所知,Laravel 5.5 已经更改了 belongsToMany
方法的签名,所以你应该等到这个包与 Laravel 5.5 兼容,我看到关于这个的问题已经创建这里:https://github.com/jenssegers/laravel-mongodb/issues/1279
此问题现已修复。请检查此 file。使用此修复程序覆盖本地文件解决了问题。
今天发布了一个支持 laravel 5.5、运行 存储库更新的版本。
在 composer 中使用版本 3.3 "jenssegers/mongodb": "3.3.*"