【发布时间】:2021-04-08 12:44:35
【问题描述】:
我在 Laravel 中构建了一个 Lingo 游戏。该应用托管在 Heroku 上:https://lingo-hu.herokuapp.com。
每当我单击“开始游戏”按钮时,它都会向我的 WordController 发送一个 HTTP-POST-REQUEST。这样做后,它会给出以下响应:
"message": "Attempt to read property \"word\" on null",
"exception": "ErrorException",
"file": "/app/app/Http/Controllers/WordController.php",
"line": 23,
我的 WordController 对“word”模型的引用:
namespace App\Http\Controllers;
use App\word;
use App\game;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Request;
class WordController extends Controller
{
}
但是,当在本地运行 Laravel 时,此操作在我的计算机上确实有效,只是在我不理解的 Heroku 上无效。
控制台错误:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
app.js:699 Uncaught (in promise) Error: Request failed with status code 500
at createError (app.js:699)
at settle (app.js:960)
at XMLHttpRequest.handleLoad (app.js:168)
数据库已启动并正在运行,我使用了php artisan migrate,它正在工作。
有人对我可能做错的地方提出建议吗?
【问题讨论】:
-
提供错误实际指代的代码......
标签: laravel heroku deployment