laravel - laravel mongodb 在 null 上调用成员函数 prepare()
问题描述
我想保存数据时出错。
该错误仅发生在VPS 服务器上,当我在localhost上运行它时,它工作正常。
我的脚本:
$rating = new \willvincent\Rateable\Rating;
$rating->rating = $request->rate;
$rating->rateable_id = $request->id;
$rating->rateable_type = 'App\Product';
$rating->user_id = auth()->user()->id;
$rating->title = $request->title;
$rating->detail = $request->detail;
$rating->save();
所有数据填写正确,只有进入$rating->save();
流程才会出现错误。
错误信息:
"message": "Call to a member function prepare() on null",
"exception": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",
"file": "/home/krabs/public_html/pricesm.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php",
"line": 452,
问题是修复:
- 问题出在我的 VPS 服务器配置上
解决方案
推荐阅读
- spring - 根据spring boot中另一个@schedule方法的完成触发@schedule
- swift - NSPopUpButton - 使用 Cocoa 绑定填充动态内容时的奇怪行为
- sql - 填充每个类别的值列表
- vba - 错误时来自 GetAttr 的意外 TRUE 返回值
- html - 如何制作弹性弹出框?
- python - 如何使用循环从用户那里获得有效输入?
- sass - SCSS 字体大小不适用
- graph - 使用节点编辑器方法设计应用程序
- android - ListView 的问题:android.content.res.Resources$NotFoundException:资源 ID #0x102000a 类型 #0x12 无效
- windows - 在 Windows 上运行 docker run 命令